IBM Support

Identifying the Java stack of a thread making an allocation request larger than a certain size

Question & Answer


Question

When you debug Java heap fragmentation or memory problems, it can be helpful to find the stack traces of the thread that makes large allocation requests.

Answer

Set generic JVM argument:

    -Xdump:stack:events=allocation,filter=#nnn

Starting with WebSphere Application Server version 6.1 with IBM SDK SR10 and later and WebSphere Application Server version 7 with IBM SDK 1.6 with SDK SR5 and later, use
-Xdump:stack:events=allocation,filter=#nnn

If you set this option to a value nnn (bytes), whenever an allocation request is made for an object size >= nnn (bytes), the Java stack trace corresponding to the thread requesting the allocation is printed into the standard error log.

There are instances when this option will not print the Java stack. It will not print Java stack when JVM considers printing of the Java stack as an unsafe operation and so the Java stack will not be printed for some threads. It is considered to be an limitation of this environment variable.

**Note: -Xdump will incur some performance overhead directly proportional to the value the filter/threshold is set.

For details on where to set the -Xdump argument:
For more information on the -Xdump argument:

To use the -Xdump option can be set to trigger a dump of the stack that makes an allocation request above or within a certain size range.

On the command line or in the generic JVM arguments set:

-Xdump:stack:events=allocation,filter=#100m

This will print the stack information for all allocations over 100m to the native_stderr.log



Or view an allocation within a certain range of values:

-Xdump:stack:events=allocation,filter=#100m..400m

This will print the stack information for all allocations between 100m and 400m to the native_stderr.log



In the native_stderr log locate the output by searching for

"JVMDUMP006I Processing dump event "allocation""


 ./java "-Xdump:stack:events=allocation,filter=#100m" -version
JVMDUMP006I Processing dump event "allocation", detail "
126456982 bytes, class [B" - please wait.
Thread=main (088B9C4C) Status=Running
at java/lang/System.getPropertyList()[Ljava/lang/String; (Native Method)
at java/lang/System.ensureProperties()V (System.java:254)
at java/lang/System.<clinit>()V (System.java:101)
at java/lang/J9VMInternals.initializeImpl(Ljava/lang/Class;)V (Native Method)
at java/lang/J9VMInternals.initialize(Ljava/lang/Class;)V (J9VMInternals.java:200)
at java/lang/ClassLoader.initializeClassLoaders()V (ClassLoader.java:72)
at java/lang/Thread.initialize(ZLjava/lang/ThreadGroup;Ljava/lang/Thread;)V (Thread.java:325)
at java/lang/Thread.<init>(Ljava/lang/String;Ljava/lang/Object;IZ)V (Thread.java:124)


[{"Product":{"code":"SSEQTP","label":"WebSphere Application Server"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Java SDK","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF016","label":"Linux"},{"code":"PF033","label":"Windows"}],"Version":"9.0;8.5;8.0;7.0","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}},{"Product":{"code":"SSNVBF","label":"Runtimes for Java Technology"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"Java SDK","Platform":[{"code":"","label":""}],"Version":"","Edition":"","Line of Business":{"code":"LOB36","label":"IBM Automation"}}]

Document Information

Modified date:
15 June 2018

UID

swg21236523