I'm investigating the OutOfMemoryError: Compressed Class Space issue. I think, that I found my root cause and solution for it (JAXBContext.newInstance() called by Hibernate Validator method: buildValidatorFactory after every submitted action by users) but during my research I've noticed one confusing thing.
I've tried to run jcmd VM.native_memory and jstat -gc to track Class committed size and CCSU (Compressed Class Space Usage):
d:\experiments>jcmd 59692 VM.native_memory summary
Native Memory Tracking:
Total: reserved=10039335KB, committed=889895KB
- Java Heap (reserved=8353792KB, committed=522240KB)
(mmap: reserved=8353792KB, committed=522240KB)
- Class (reserved=1072460KB, **committed=24268KB**)
(classes #2518)
(malloc=9548KB #2393)
(mmap: reserved=1062912KB, committed=14720KB)
and
d:\experiments>jstat -gc 59692 2s
S0C S1C S0U S1U EC EU OC OU MC MU CCSC CCSU YGC YGCT FGC FGCT CGC CGCT GCT
21504,0 21504,0 0,0 0,0 131072,0 56218,7 139264,0 7755,5 14976,0 14318,5 1920,0 1721,7 2 0,012 1 0,036 - - 0,048
I expected that there is no major difference between "Class committed" metric in NMT and CCSU in jstat, but jstat shows about only 1,72 MB of used memory against Class Committed which is over 24 MB. So I generated GC.class_stats statistic and it shows that KlassBytes is about 1738616 B -> 1,739 MB - so it approximettely the same value as jstat shows in CCSU. Also I found out that the rest of metadata like Methods, Constants etc.) occupied about 14,44 MB (this is approximetly the same as value in mmap: committed=14720KB - but I don't know what is this number).
So where is the rest of it? What exactly is the number presented by NMT?