mirror of
https://github.com/openjdk/jdk.git
synced 2026-03-28 16:50:10 +00:00
8376398: [TESTBUG] Testing of Unsafe native (re)allocation is sensitive to current JDK native memory use
Reviewed-by: azafari
This commit is contained in:
parent
262b31be3d
commit
08ff2bf4d0
@ -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
|
||||
|
||||
@ -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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user