G1 performs class unloading during the Remark phase, which is the stop of the world:
[GC remark 2019-03-26T14:27:52.926+0000: 18.798: [Finalize Marking, 0.0004509 secs] 2019-03-26T14:27:52.926+0000: 18.799: [GC ref-proc, 0.0002791 secs] 2019-03-26T14:27:52.926+0000: 18.799: [Unloading, 0.0058844 secs], 0.0073053 secs]
Please note that it is Java 8 that replaces Permgen with Metaspace, and the CMS also performs class unloading (with the CMSClassUnloadingEnabled switch), so if you still have Out of Memory errors, this will not help.
source share