From 08ff2bf4d0541f7b3fd7c4a9c7f386cb710510af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eirik=20Bj=C3=B8rsn=C3=B8s?= Date: Wed, 18 Mar 2026 14:12:43 +0000 Subject: [PATCH] 8376398: [TESTBUG] Testing of Unsafe native (re)allocation is sensitive to current JDK native memory use Reviewed-by: azafari --- test/hotspot/jtreg/runtime/Unsafe/AllocateMemory.java | 4 ++-- test/hotspot/jtreg/runtime/Unsafe/Reallocate.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/hotspot/jtreg/runtime/Unsafe/AllocateMemory.java b/test/hotspot/jtreg/runtime/Unsafe/AllocateMemory.java index 7d8d33b1225..b18bcb8cc13 100644 --- a/test/hotspot/jtreg/runtime/Unsafe/AllocateMemory.java +++ b/test/hotspot/jtreg/runtime/Unsafe/AllocateMemory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,7 +61,7 @@ public class AllocateMemory { // allocateMemory() should throw an OutOfMemoryError when the underlying malloc fails, // since we start with -XX:MallocLimit try { - address = unsafe.allocateMemory(100 * 1024 * 1024); + address = unsafe.allocateMemory(101 * 1024 * 1024); throw new RuntimeException("Did not get expected OutOfMemoryError"); } catch (OutOfMemoryError e) { // Expected diff --git a/test/hotspot/jtreg/runtime/Unsafe/Reallocate.java b/test/hotspot/jtreg/runtime/Unsafe/Reallocate.java index c15b931449d..dc0ce86fa1f 100644 --- a/test/hotspot/jtreg/runtime/Unsafe/Reallocate.java +++ b/test/hotspot/jtreg/runtime/Unsafe/Reallocate.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -62,7 +62,7 @@ public class Reallocate { // Make sure we can throw an OOME when we fail to reallocate due to OOM try { - unsafe.reallocateMemory(address, 100 * 1024 * 1024); + unsafe.reallocateMemory(address, 101 * 1024 * 1024); } catch (OutOfMemoryError e) { // Expected return;