IBM Support

IBM Java for Linux HowTo: Tracking Native Memory on Java 6 and 7 for Linux

Technote (FAQ)


IBM Java for Linux HowTo: Tracking Native Memory on Java 6 and 7 for Linux


This document provides step-by-step instructions for enabling tracking of native memory for IBM Java 6 and 7 on Linux.
Jump to section: ( Background) ( Setup) ( Monitor) ( Package) ( Upload)
The instructions in this document make references to generic terms in Italics that will need to be replaced with information specific to the support call and the environment. It is very important that consistent and accurate values be used in place of the Italicized generic terms when collecting the data to ensure the prompt and correct delivery of the data when uploaded.
Generic Term Replace with

The parent Java installation directory (e.g. /opt/ibm/java-ppc64_70).
The process id of the active Java process (e.g. use "ps" command to check the PID column to identify the process).
Step-by-Step Instructions

Step 1:


The Java 6 and 7 runtimes allocate native memory for the JIT compiled code, classes, class loaders, JNI allocations, direct byte buffer allocations, and thread stack allocations, etc. If you believe you are running out of native memory, you can use the Linux Native Tracker(LNT) library to trace memory allocations on the native heap. The Linux Native Tracker library, can be built from the Linux Native Trackers source code (, available at It journals all memory allocations and deallocations in the jvm..

Step 2:


Check Java version:

JAVA_PATH /bin/java -verson

Ensure that it shows "Java 7 or Java 6"

Example: java -version

java version "1.7.0"

Unpack the tracker

tar xzf nativetracker.tgz

(Optional )Set the plaform

The makefile will detect the machine type and build the native tracker for the appropriate build. If a different build is desired, for example a 32 bit build while running on a 64 bit machine, set the PLATFORM value.

export PLATFORM= arch where arch is typically i686 or ppc

Enter the tracker directory

cd LinuxNativeTracker

Set the Java directory


Build the library


Once the build completes, install it

make install

The will be moved to the JAVA_PATH/jre/lib/arch/ directory

Enable LNT on the Linux shell:

export IBM_NATIVETOOLS=memory_tracking

This option enables the memory tracking.


where "n" specifies the duration in seconds between writes. By default, data is written every 600 seconds (10 minutes)


where "n" specifies how many frames will be listed in the stack trace. By default, the stack depth is 7.

Start your java application as normal. For example: java HelloWorld

Tracker output is redirected to the output file, native_memory_ PID .log, in the application's working directory. Please ensure there is enough space in the filesystem for this large file.

Step 3:

Monitor the process size until it grows sufficiently large. You can use the top -p PID command to monitor the virtual and physical memory usage.

top -p PID -d delay-time -n iterations

where PID is the process id, delay-time is the time between writes, and iterations is the number of writes

For instance, to monitor a java process id, 10303, every ten minutes for a two days enter:

top -p 10303 -d 600 -n 288 -b >> process_size.log

Once the process size grows to three times the application's Xmx (max heap) value, gracefully exit the application.

Step 4:


Package the process_size.log and native_memory_ PID.log

tar -cf - process_size.log native_memory_PID | gzip -c >PMR.MM-DD-YY.tgz

where PMR is the pmr number (ex. 44722,333,000)
and MM-DD-YY is the month, day, and year

Step 5:


Upload the packaged data or individual files to an IBM secured server using one of upload options provided on the "MustGather: How to upload diagnostic data and testcases to IBM" web page:

Step 6:


Step 7:


Step 8:


Step 9:


Step 10:


Step 11:


Step 12:


Step 13:


Step 14:


Step 15:


Step 16:


Step 17:


Step 18:


Step 19:


Step 20:


Step 21:


Document Type: Instruction
Content Type: Howto | Troubleshooting | Mustgather | Workaround | FAQ | Alert
Hardware: all Power | Power5 | Power6 | Power7 | Power8
Operating System: all Linux Versions
IBM Java: all Java Versions | Java 6.0 | Java 6.1 | Java 7.0 | Java 7.1 | Java 8.0
Author(s): John Carver
Reviewer(s): John Carver

Document information

More support for: IBM Java

Software version: Version Independent

Operating system(s): Linux

Reference #: T1024366

Modified date: 10 August 2017