Skip to main content

Problem

  • Product Name: AppServer
  • Product Version: All
  • Product Component: Others
  • Platform/OS version: All
  • JDK: 1.4.2, 1.5.0
  • Patch Level: All

Borland AppServer console has provided a thread dump “Dump Stack to Log” feature for user to collect the thread dump information to debug their applications. At times, it is necessary to collect the heap dump information to understand the types of objects, the instances for each object and the size used for each object. Currently, Borland AppServer console does not provide this feature.

Resolution

Sun JVM

Generally there are some options provided by the JVM that can help debugging. For example:

 -XX:HeapDumpPath=./java_pid.hprof
Path to directory or filename for heap dump. Manageable. (Introduced in 1.4.2update 12, 5.0 update 7.)

-XX:-HeapDumpOnOutOfMemoryError Dump heap to file whenjava.lang.OutOfMemoryError is thrown. Manageable. (Introduced in 1.4.2 update12, 5.0 update 7.)

Additionally, the -Xrunhprof utility will be helpful,

for example:
java -Xrunhprof:heap=dump,file=heap_dump.hprof

For detailed explanation, please refer to Oracle documentation.

If you are starting your application using the vbj command, you maypass the option by prefix “–J” to options to pass the option to JVM. For example:

vbj -Xrunhprof:heap=dump,file=heap_dump.hprof . T

This will dump the heap when application exit.

IBM JVM

The example below shows the production of a Heapdump. In this case, both a .phd file and a classic (.txt) Heapdump have been requested by the use of the “opts=” option:

vbj -J-Xdump:heap:events=vmstop,opts=PHD CLASSIC

For detailed usage, you might need to refer IBM documentation.

HP JVM

There are 2 similar options provided by the HP JVM.

The -XX: HeapDump option can be used to observe memory allocation in a running Java application by taking snapshots of the heap over time.

The other option to get heap dumps is to use the _JAVA_HEAPDUMP environment variable; setting this environment variable allows memory snapshots to be taken without making any modifications to the Java command line. In order to enable this functionality, either use the command-line option or set the environment variable (for example, export _JAVA_HEAPDUMP=1) before starting the Java application. This option is available beginning with SDK 1.4.2.10 and JDK 1.5.0.03.

For additional explanation, please refer to HP JVM documentation.

Old KB# 15558


#Security
#Heapdump
#VisiBroker
#AppServer
#JVM