To enable native memory tracking on java 7 and 8, just add one of the following options on your $MULE_HOME/conf/wrapper.conf mule wrapper configuration file:
wrapper.java.additional.<n>=-XX:NativeMemoryTracking=detail # for a detailed report
or
wrapper.java.additional.<n>=-XX:NativeMemoryTracking=summary # for a summarized report
Note: as usual when adding Java properties to wrapper.conf, you need to replace the <n> placeholder for a suitable available number. See KB article How can I set Mule and Java system properties at startup? for more details.
The Mule instance will need to be restarted for the change to take effect.
After the restart, you can execute a native memory tracking report, by issuing the following command:
$ $JAVA_HOME/bin/jcmd <pid of mule JVM> VM.native_memory detail
Note: the examples assume the Linux environment variable JAVA_HOME points to the Java JDK installation directory. You can replace it directly by the complete path the commands. Same applies for Windows, except that the convention for environment variables uses characters '%' enclosing the variable name, instead of a '$' at the beginning. Eg: %JAVA_HOME%.
If you want to make comparison on native memory usage to a certain point in time, you can use baselines, as shown below:
$ $JAVA_HOME/bin/jcmd <pid of mule JVM> VM.native_memory baseline
Once you have defined the baseline, you can query the actual memory usage compared with the baseline, by issuing the following command:
$ $JAVA_HOME/bin/jcmd <pid of mule JVM> VM.native_memory detail.diff
This will give you relative values of memory, with respect to the baseline, which is very useful when trying to identify how fast native memory grows over time.
Please refer to the following Oracle's official document for additional information on tracking native memory:
https://docs.oracle.com/javase/8/docs/technotes/guides/troubleshoot/tooldescr007.html
Enabling native memory tracking at JVM shutdown
You can enable a native memory tracking report to be generated automatically when the JVM shuts down.
To accomplish that, you should add the following option on your $MULE_HOME/conf/wrapper.conf file:
wrapper.java.additional.<n>=-XX:+UnlockDiagnosticVMOptions wrapper.java.additional.<n>=-XX:+PrintNMTStatistics
Depending on the configure value ("detail" or "summary") of the "-XX:NativeMemoryTracking" parameter, a corresponding native memory tracking report will be generated and appended to the end of the $MULE_HOME/logs/mule_ee.log file.
Here is an example of Native Memory Tracking summary:
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (malloc) failed to allocate 32744 bytes. Error detail: ChunkPool::allocate
# An error report file with more information is saved as:
# /apps/mule/mycoprd/mule-clst1/lib/boot/tanuki/exec/hs_err_pid11075992.log
Native Memory Tracking:
Total: reserved=30777863579, committed=25270611355
malloc: 17004424603 #2969994
mmap: reserved=13773438976, committed=8266186752
- Java Heap (reserved=10737418240, committed=6333399040)
(mmap: reserved=10737418240, committed=6333399040)
- Class (reserved=1098878319, committed=212569455)
(classes #232991)
( instance classes #223785, array classes #9206)
(malloc=25136495 #562493) (peak=25177183 #563537)
(mmap: reserved=1073741824, committed=187432960)
( Metadata: )
( reserved=1275068416, committed=1224146944)
( used=1220106136)
( waste=4040808 =0.33%)
( Class space:)
( reserved=1073741824, committed=187432960)
( used=183649552)
( waste=3783408 =2.02%)
- Thread (reserved=16418916256, committed=16418916256)
(thread #7509)
(Stack: 16246324520)
(malloc=11797688 #45168) (peak=12181968 #52945)
(arena=160794048 #15014) (peak=195979288 #14910)
- Code (reserved=267287252, committed=264534740)
(malloc=13597396 #82198) (peak=14139876 #88778)
(mmap: reserved=253689856, committed=250937344)
- GC (reserved=542689859, committed=379505219)
(malloc=109300291 #130985) (peak=181439023 #91178)
(mmap: reserved=433389568, committed=270204928)
- Compiler (reserved=11061112, committed=11061112)
(malloc=10892552 #17269) (peak=11064728 #24439)
(arena=168560 #5) (peak=127306512 #94)
- Internal (reserved=21666759, committed=21601223)
(malloc=21535687 #311294) (peak=22299131 #332099)
(mmap: reserved=131072, committed=65536)
- Other (reserved=265100712, committed=265100712)
(malloc=265100712 #7916) (peak=383482360 #6971)
- Symbol (reserved=76251000, committed=76251000)
(malloc=72315008 #1697914) (peak=72315024 #1697915)
(arena=3935992 #1) (at peak)
- Native Memory Tracking (reserved=48862192, committed=48862192)
(malloc=1342288 #23950) (at peak)
(tracking overhead=47519904)
- Arena Chunk (reserved=373344, committed=373344)
(malloc=373344 #19784) (peak=204820136 #20935)
- Tracing (reserved=1, committed=1)
(malloc=1 #1) (at peak)
- Arguments (reserved=81, committed=81)
(malloc=81 #4) (peak=9321 #5)
- Module (reserved=5631248, committed=5631248)
(malloc=5631248 #34576) (peak=5811760 #35090)
- Synchronization (reserved=1545844, committed=1545844)
(malloc=1545844 #12146) (peak=1552372 #12197)
- Serviceability (reserved=1786400, committed=1786400)
(malloc=1786400 #13432) (peak=2183616 #16411)
- Metaspace (reserved=1280239456, committed=1229317984)
(malloc=5171040 #2886) (peak=5226976 #3070)
(mmap: reserved=1275068416, committed=1224146944)
- String Deduplication (reserved=608, committed=608)
(malloc=608 #8) (at peak)
- Object Monitors (reserved=154896, committed=154896)
(malloc=154896 #461) (peak=830592 #2472)
001114773

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.