With Java 8 I occasionally used both, -XX:+PrintClassHistogramBeforeFullGC and -XX:+PrintClassHistogramAfterFullGC to get an impression about which classes contribute most to the garbage to be cleaned out.
Both options are gone at least since Java 17.
Is there a good or even better way to get a hint about the biggest garbage contributors with Java 17 or Java 21?