8298341: Ensure heap growth in TestNativeMemoryUsageEvents.java

Reviewed-by: egahlin, stuefe
This commit is contained in:
Stefan Johansson 2022-12-08 09:33:06 +00:00
parent 1166c8e2c0
commit 46cd457b0f

@ -103,6 +103,15 @@ public class TestNativeMemoryUsageEvents {
// Generate data to force heap to grow.
generateHeapContents();
// To allow the two usage events to share a single NMTUsage snapshot
// there is an AgeThreshold set to 50ms and if the two events occur
// within this interval they will use the same snapshot. On fast
// machines it is possible that the whole heap contents generation
// take less than 50ms and therefor both beginChunk end endChunk
// events will use the same NMTUsage snapshot. To avoid this, do
// a short sleep.
Thread.sleep(100);
recording.stop();
}