Skip to content

Commit

Permalink
[GC] Fix a test failure on G1 Concurrent GC MXBean
Browse files Browse the repository at this point in the history
Summary: G1 Concurrent GC only monitors G1 Old Gen

Testing: hotspot/jtreg

Reviewers: mmyxym, weixlu

Issue: dragonwell-project#790
  • Loading branch information
linade committed Feb 1, 2024
1 parent ec344b1 commit 32ef3e5
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,11 @@ private static void checkGarbageCollectionNotificationInfoContent(GarbageCollect
System.out.println(" Before GC: " + busage);
System.out.println(" After GC: " + ausage);

checkMemoryUsage(poolname, busage, ausage);
String checkedPoolName = "Eden Space";
if ("G1 Concurrent GC".equals(notif.getGcName())) {
checkedPoolName = "G1 Old Gen";
}
checkMemoryUsage(poolname, checkedPoolName, busage, ausage);
}

// check if memory usage for all memory pools are returned
Expand All @@ -167,8 +171,9 @@ private static void checkGarbageCollectionNotificationInfoContent(GarbageCollect
}
}

private static void checkMemoryUsage(String poolname, MemoryUsage busage, MemoryUsage ausage) throws Exception {
if (poolname.contains("Eden Space") && busage.getUsed() > 0) {
private static void checkMemoryUsage(String poolname, String checkedPoolName,
MemoryUsage busage, MemoryUsage ausage) throws Exception {
if (poolname.contains(checkedPoolName) && busage.getUsed() > 0) {
// Used size at Eden Space should be decreased or
if (busage.getUsed() <= ausage.getUsed()) {
throw new RuntimeException("Used size at Eden Space should be decreased.");
Expand Down

0 comments on commit 32ef3e5

Please sign in to comment.