8149778: serviceability/tmtools/jstat/GcCapacityTest.java causes JVM to hang during GC

Reviewed-by: pliden, stefank
This commit is contained in:
Robbin Ehn 2016-06-15 09:43:42 +02:00
parent 2d7e2d242f
commit f5b4d9e51f
2 changed files with 3 additions and 3 deletions

View File

@ -33,7 +33,6 @@ import utils.*;
* @requires vm.opt.ExplicitGCInvokesConcurrent != true * @requires vm.opt.ExplicitGCInvokesConcurrent != true
* @build common.* * @build common.*
* @build utils.* * @build utils.*
* @ignore 8149778
* @run main/othervm -XX:+UsePerfData -Xmx128M GcCapacityTest * @run main/othervm -XX:+UsePerfData -Xmx128M GcCapacityTest
*/ */
public class GcCapacityTest { public class GcCapacityTest {

View File

@ -42,8 +42,9 @@ public class GcProvokerImpl implements GcProvoker {
// uses fixed small objects to avoid Humongous objects allocation in G1 // uses fixed small objects to avoid Humongous objects allocation in G1
int memoryChunk = 2048; int memoryChunk = 2048;
List<Object> list = new ArrayList<>(); List<Object> list = new ArrayList<>();
float used = 0; long used = 0;
while (used < targetUsage * maxMemory) { long target = (long) (maxMemory * targetUsage);
while (used < target) {
try { try {
list.add(new byte[memoryChunk]); list.add(new byte[memoryChunk]);
used += memoryChunk; used += memoryChunk;