8149778: serviceability/tmtools/jstat/GcCapacityTest.java causes JVM to hang during GC
authorrehn
Wed, 15 Jun 2016 09:43:42 +0200
changeset 39285 2ab363810925
parent 39284 d504ca981ccf
child 39286 0613bf956db4
8149778: serviceability/tmtools/jstat/GcCapacityTest.java causes JVM to hang during GC Reviewed-by: pliden, stefank
hotspot/test/serviceability/tmtools/jstat/GcCapacityTest.java
hotspot/test/serviceability/tmtools/jstat/utils/GcProvokerImpl.java
--- a/hotspot/test/serviceability/tmtools/jstat/GcCapacityTest.java	Tue Jun 14 19:30:19 2016 +0000
+++ b/hotspot/test/serviceability/tmtools/jstat/GcCapacityTest.java	Wed Jun 15 09:43:42 2016 +0200
@@ -33,7 +33,6 @@
  * @requires vm.opt.ExplicitGCInvokesConcurrent != true
  * @build common.*
  * @build utils.*
- * @ignore 8149778
  * @run main/othervm -XX:+UsePerfData -Xmx128M GcCapacityTest
  */
 public class GcCapacityTest {
--- a/hotspot/test/serviceability/tmtools/jstat/utils/GcProvokerImpl.java	Tue Jun 14 19:30:19 2016 +0000
+++ b/hotspot/test/serviceability/tmtools/jstat/utils/GcProvokerImpl.java	Wed Jun 15 09:43:42 2016 +0200
@@ -42,8 +42,9 @@
         // uses fixed small objects to avoid Humongous objects allocation in G1
         int memoryChunk = 2048;
         List<Object> list = new ArrayList<>();
-        float used = 0;
-        while (used < targetUsage * maxMemory) {
+        long used = 0;
+        long target = (long) (maxMemory * targetUsage);
+        while (used < target) {
             try {
                 list.add(new byte[memoryChunk]);
                 used += memoryChunk;