Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GC] Fix a test failure on G1 Concurrent GC MXBean #789

Merged
merged 1 commit into from
Feb 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,11 +171,12 @@ 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) {
// Used size at Eden Space should be decreased or
private static void checkMemoryUsage(String poolname, String checkedPoolName,
MemoryUsage busage, MemoryUsage ausage) throws Exception {
if (poolname.contains(checkedPoolName) && busage.getUsed() > 0) {
// Used size at the checked pool should be decreased or
if (busage.getUsed() <= ausage.getUsed()) {
throw new RuntimeException("Used size at Eden Space should be decreased.");
throw new RuntimeException("Used size at " + checkedPoolName + " should be decreased.");
}
}
}
Expand Down
Loading