IBM Support

IBM Java for Linux HowTo: Tracking Native Memory on Java 8 for Linux

Question & Answer


Question

IBM Java for Linux HowTo: Tracking Native Memory on Java 8 for Linux

Answer

This document provides step-by-step instructions for enabling tracking of native memory for IBM Java 8 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
JAVA_PATH
PID
The parent Java installation directory (e.g. /usr/java6 or /usr/java7_64).
The process id of the active Java process (e.g. use "ps" command to check the PID column to identify the process).
Overview
Step-by-Step Instructions
Step 1:

Background


The Java 8 runtime allocates native memory for the JIT compiled code, classes, class loaders, JNI allocations, direct byte buffer allocations, and thread stack allocations. If you believe you are running out of native memory, you can use the Linux Native Tracker library to trace memory allocations on the native heap. The Linux Native Tracker(LNT) library, libnative_tracker.so, is included with the Java 8 distribution. It journals all memory allocations and deallocations in the jvm.

Step 2:

Setup

A. Check Java version:

JAVA_PATH/bin/java -verson

Ensure that it shows "Java 8"

Example: java -version

java version "1.8.0"

Enable LNT on the Linux shell:

export IBM_NATIVETOOLS=memory_tracking

This option enables the memory tracking.

export PROFILER_WRITE_PERIOD_SECONDS=n

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

export PROFILER_STACK_DEPTH=n

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 ample space in the filesystem for this large file.

Step 3:
Monitor


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


Package the process_size.log and native_memory_PID.log

tar -cf - process_size.log native_memory_PID.log | 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

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:

http://www-01.ibm.com/support/docview.wss?uid=isg3T1022619

Step 6:

ACTION
Step 7:

ACTION
Step 8:

ACTION
Step 9:

ACTION
Step 10:

ACTION
Step 11:

ACTION
Step 12:

ACTION
Step 13:

ACTION
Step 14:

ACTION
Step 15:

ACTION
Step 16:

ACTION
Step 17:

ACTION
Step 18:

ACTION
Step 19:

ACTION
Step 20:

ACTION
Step 21:

ACTION
Document Type: Instruction
Content Type: Howto | Troubleshooting | Mustgather | Workaround | FAQ | Alert
Hardware: all Power | Power5 | Power6 | Power7 | Power8
Operating System: all Linux
IBM Java: all Java Versions | Java 8.0
Author(s): John Carver
Reviewer(s): John Carver
[{"Product":{"code":"SG9NGS","label":"IBM Java"},"Business Unit":{"code":null,"label":null},"Component":"--","Platform":[{"code":"PF016","label":"Linux"}],"Version":"Version Independent","Edition":"","Line of Business":{"code":"LOB08","label":"Cognitive Systems"}}]

Document Information

More support for:
IBM Java

Software version:
Version Independent

Operating system(s):
Linux

Document number:
629833

Modified date:
17 June 2018

UID

isg3T1024370

Manage My Notification Subscriptions