8301326: Optimize compiler/uncommontrap/TestDeoptOOM.java test
Reviewed-by: rcastanedalo, thartmann
This commit is contained in:
parent
9cc0171ed5
commit
cdb4ba9657
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2014, 2021, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2014, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -67,19 +67,24 @@ public class TestDeoptOOM {
|
|||||||
|
|
||||||
static LinkedList ll;
|
static LinkedList ll;
|
||||||
|
|
||||||
static void consume_all_memory() {
|
static void alloc_in_chunks(int size) {
|
||||||
int size = 128 * 1024 * 1024;
|
try {
|
||||||
while(size > 0) {
|
while(true) {
|
||||||
try {
|
ll = new LinkedList(ll, size);
|
||||||
while(true) {
|
|
||||||
ll = new LinkedList(ll, size);
|
|
||||||
}
|
|
||||||
} catch(OutOfMemoryError oom) {
|
|
||||||
}
|
}
|
||||||
size = size / 2;
|
} catch(OutOfMemoryError oom) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void consume_all_memory() {
|
||||||
|
// O(MiB) allocations
|
||||||
|
alloc_in_chunks(1024*1024);
|
||||||
|
// O(KiB) allocations
|
||||||
|
alloc_in_chunks(1024);
|
||||||
|
// O(B) allocations
|
||||||
|
alloc_in_chunks(1);
|
||||||
|
}
|
||||||
|
|
||||||
static void free_memory() {
|
static void free_memory() {
|
||||||
ll = null;
|
ll = null;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user