MaxRAMPercentage vs a hardcoded -Xmx, -XX:-UseContainerSupport, the ActiveProcessorCount lie, and which diagnostic flags are worth leaving on in prod, verified in real Docker containers on JDK 25 and JDK 27. Co-Authored-By: Claude Sonnet 5 <[email protected]>
98 lines
4.6 KiB
Plaintext
98 lines
4.6 KiB
Plaintext
$ docker run -d --memory=512m --name nmtdemo -v $PWD/docker/flags-demo.jar:/app.jar --entrypoint java flags-demo:jdk25-jdk \
|
|
-XX:NativeMemoryTracking=summary -XX:MaxRAMPercentage=75 -jar /app.jar
|
|
$ docker exec nmtdemo jcmd 1 VM.native_memory summary
|
|
|
|
=== Diagnostic: -XX:NativeMemoryTracking=summary via jcmd ===
|
|
1:
|
|
|
|
Native Memory Tracking:
|
|
|
|
(Omitting categories weighting less than 1KB)
|
|
|
|
Total: reserved=1824154KB, committed=115878KB
|
|
malloc: 34018KB #144561, peak=35841KB #140626
|
|
mmap: reserved=1790136KB, committed=81860KB
|
|
|
|
- Java Heap (reserved=393216KB, committed=23532KB)
|
|
(mmap: reserved=393216KB, committed=23532KB, at peak)
|
|
|
|
- Class (reserved=1049299KB, committed=5075KB)
|
|
(classes #8049)
|
|
( instance classes #7466, array classes #583)
|
|
(malloc=723KB tag=Class #15577) (at peak)
|
|
(mmap: reserved=1048576KB, committed=4352KB, at peak)
|
|
( Metadata: )
|
|
( reserved=65536KB, committed=27072KB)
|
|
( used=26779KB)
|
|
( waste=293KB =1.08%)
|
|
( Class space:)
|
|
( reserved=1048576KB, committed=4352KB)
|
|
( used=4187KB)
|
|
( waste=165KB =3.79%)
|
|
|
|
- Thread (reserved=17468KB, committed=1380KB)
|
|
(threads #17)
|
|
(stack: reserved=17408KB, committed=1320KB, peak=1320KB)
|
|
(malloc=42KB tag=Thread #105) (peak=51KB #108)
|
|
(arena=18KB #30) (peak=301KB #22)
|
|
|
|
- Code (reserved=252158KB, committed=16014KB)
|
|
(malloc=4465KB tag=Code #21734) (at peak)
|
|
(mmap: reserved=247692KB, committed=11548KB, at peak)
|
|
(arena=1KB #1) (peak=34KB #2)
|
|
|
|
- GC (reserved=1302KB, committed=102KB)
|
|
(malloc=22KB tag=GC #58) (peak=96KB #79)
|
|
(mmap: reserved=1280KB, committed=80KB, at peak)
|
|
|
|
- Compiler (reserved=8163KB, committed=8163KB)
|
|
(malloc=54KB tag=Compiler #86) (peak=69KB #91)
|
|
(arena=8110KB #14) (peak=22951KB #14)
|
|
|
|
- Internal (reserved=1324KB, committed=1324KB)
|
|
(malloc=1288KB tag=Internal #5521) (at peak)
|
|
(mmap: reserved=36KB, committed=36KB, at peak)
|
|
|
|
- Other (reserved=20KB, committed=20KB)
|
|
(malloc=20KB tag=Other #3) (at peak)
|
|
|
|
- Symbol (reserved=6745KB, committed=6745KB)
|
|
(malloc=6034KB tag=Symbol #93254) (at peak)
|
|
(arena=712KB #1) (at peak)
|
|
|
|
- Native Memory Tracking (reserved=2576KB, committed=2576KB)
|
|
(malloc=35KB tag=Native Memory Tracking #619) (at peak)
|
|
(tracking overhead=2541KB)
|
|
|
|
- Shared class space (reserved=16384KB, committed=13912KB, readonly=0KB)
|
|
(mmap: reserved=16384KB, committed=13912KB, peak=14120KB)
|
|
|
|
- Arena Chunk (reserved=9219KB, committed=9219KB)
|
|
(malloc=9219KB tag=Arena Chunk #541) (peak=23793KB #558)
|
|
|
|
- Tracing (reserved=5KB, committed=5KB)
|
|
(malloc=5KB tag=Tracing #22) (at peak)
|
|
|
|
- Module (reserved=80KB, committed=80KB)
|
|
(malloc=80KB tag=Module #2158) (at peak)
|
|
|
|
- Safepoint (reserved=8KB, committed=8KB)
|
|
(mmap: reserved=8KB, committed=8KB, at peak)
|
|
|
|
- Synchronization (reserved=483KB, committed=483KB)
|
|
(malloc=483KB tag=Synchronization #4738) (at peak)
|
|
|
|
- Serviceability (reserved=17KB, committed=17KB)
|
|
(malloc=17KB tag=Serviceability #14) (peak=20KB #18)
|
|
|
|
- Metaspace (reserved=65672KB, committed=27208KB)
|
|
(malloc=136KB tag=Metaspace #46) (at peak)
|
|
(mmap: reserved=65536KB, committed=27072KB, at peak)
|
|
|
|
- String Deduplication (reserved=1KB, committed=1KB)
|
|
(malloc=1KB tag=String Deduplication #8) (at peak)
|
|
|
|
- Object Monitors (reserved=13KB, committed=13KB)
|
|
(malloc=13KB tag=Object Monitors #69) (at peak)
|
|
|