The output of jcmd <pid> VM.native_memory
shows a Class
and Metaspace
section like below
Class (reserved=1053604KB, committed=39012KB)
(classes #46737)
( instance classes #44474, array classes #2263)
(malloc=5028KB #107972) (peak=5042KB #107808)
(mmap: reserved=1048576KB, committed=33984KB)
( Metadata: )
( reserved=262144KB, committed=257280KB)
( used=255927KB)
( waste=1353KB =0.53%)
( Class space:)
( reserved=1048576KB, committed=33984KB)
( used=32654KB)
( waste=1330KB =3.91%)
and
Metaspace (reserved=263756KB, committed=258892KB)
(malloc=1612KB #1525) (at peak)
(mmap: reserved=262144KB, committed=257280KB)
Can someone tell me the difference between the Class
and Metaspace
sections? Is the Metadata
shown under Class
the same as Metaspace
?
Output of java -version
openjdk version "17.0.11" 2024-04-16
OpenJDK Runtime Environment Temurin-17.0.11+9 (build 17.0.11+9)
OpenJDK 64-Bit Server VM Temurin-17.0.11+9 (build 17.0.11+9, mixed mode, sharing)
As pointed out by @apangin in the comment, from the question Class (reserved=1053604KB
refers to Compressed Class Space
, and Metaspace (reserved=263756KB
refers to non-class space. For more explanation, read this answer by @apangin.