Search code examples
javajvm-argumentsjava1.4

How to identify java heap size in 1.4


I am running Java 1.4 (java version "1.4.2_08")

I wanted to know what is the current heap size of JVM .

When I ran below command

java -XX:+PrintFlagsFinal -version | grep -iE 'HeapSize|                                                                                        PermSize|ThreadStackSize'

I get this error:

Unrecognized VM option '+PrintFlagsFinal'
Could not create the Java virtual machine.

I gone through some articles, and came to know this command in not supported by Java 1.4 version.


Solution

  • I was able to dig this up: http://sysadminsjourney.com/content/2008/09/05/profiling-your-java-142-memory-heap/

    The part you are probably interested in:

    The key is to have your app do a heap dump when sending it the QUIT signal. Append this option to your java options on startup of your application:

    -XX:+HeapDumpOnCtrlBreak
    

    After that, you need to send it a SIGQUIT (kill -3 <PID>). It will dump the heap to a file and you can go to town on that.

    But please consider upgrading.