How to identify java heap size in 1.4

430 Views Asked by At

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.

2

There are 2 best solutions below

2
Z4-tier On BEST ANSWER

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.

0
Karol Dowbecki On

As per Ergonomics in the 5.0 Java TM Virtual Machine, if you haven't specified -Xms or -Xmx arguments in the Java 1.4 process command line it will be between 4 MB and 64 MB:

In the J2SE platform version 1.4.2 by default the following selections were made

  • Serial garbage collector
  • Heap sizes
  • initial heap size of 4 Mbyte
  • maximum heap size of 64 Mbyte
  • Client runtime compiler

You could try to install the JMX extension for Java 1.4 to get the runtime values but unfortunately it seems that the download is no longer available from the official Oracle website.

Without JMX extension you can't use JConsole, as per docs:

Applications that are not attachable, with the management agent disabled. These include applications started on a Java SE 1.4.2 platform or started on a Java SE 5.0 platform without the -Dcom.sun.management.jmxremote or com.sun.management.jmxremote.port options.

You are doing archaeology. I think you should accept that you won't get a perfect answer and just see how much memory is operating system allocating to the JVM process.