8361451: Test vmTestbase/metaspace/stressHierarchy/stressHierarchy012/TestDescription.java fails with OutOfMemoryError: Metaspace

Reviewed-by: dholmes, lmesnik, iklam, syan
This commit is contained in:
Coleen Phillimore 2025-10-22 12:34:17 +00:00
parent 65b3239418
commit 92e380c59c

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -136,8 +136,17 @@ public class PerformChecksHelper {
}
}
}
} catch (InvocationTargetException ite) {
Throwable cause = ite.getCause();
if (cause != null && (cause instanceof OutOfMemoryError) && cause.getMessage().contains("Metaspace")) {
// avoid string concatenation, which may create more classes.
System.out.println("Got OOME in metaspace in PerformChecksHelper.callMethods(Class clazz). ");
System.out.println("This is possible with -triggerUnloadingByFillingMetaspace");
} else {
throw ite;
}
} catch (OutOfMemoryError e) {
if (e.getMessage().trim().toLowerCase().contains("metaspace")) {
if (e.getMessage().contains("Metaspace")) {
// avoid string concatenation, which may create more classes.
System.out.println("Got OOME in metaspace in PerformChecksHelper.callMethods(Class clazz). ");
System.out.println("This is possible with -triggerUnloadingByFillingMetaspace");