In [~huntch]'s (internal) class loading/unloading stress test G1 starts failing to unload classes during concurrent cycles after a short while.
Only Full GCs with a cause of "Metadata GC Threshold" when metaspace reaches MaxMetaspaceSize can clear out metaspace.
If there is no MaxMetaspaceSize set it is expected that the metaspace will grow until the process is killed or there is a different reason for a full gc.
After that G1 will never be able to clean out metaspace using concurrent cycles. (This may be because the test program does the same forever from that point on).
Only reproduces with release builds. JDK11 does not show the issue - it cleans out metaspace regularly using concurrent cycles.
The change that started this behavior to show up is JDK-8210155: Lock ClassLoaderDataGraph . It may not be directly responsible for that.