JVM Heap Size


Is it possible to find out the JVM heap size on Integration server?
I am using 7.1.2 on UNIX platform.

It will be better if i get any built-in service other than from WmRoot package. :o

Any help would be appreciated. Thanks in advance.

Rohit Ware


You could write a small Java service like the following to get certain heap size values. It would take no inputs and have 3 outputs (freeMemory, maxMemory, and totalMemory):

Runtime r = Runtime.getRuntime();

IDataCursor pipelineCursor = pipeline.getCursor();
IDataUtil.put( pipelineCursor, “freeMemory”, ((Long)r.freeMemory()).toString() );
IDataUtil.put( pipelineCursor, “maxMemory”, ((Long)r.maxMemory()).toString() );
IDataUtil.put( pipelineCursor, “totalMemory”, ((Long)r.totalMemory()).toString() );

Here’s what the 3 values mean, taken from the Java Doc for JDK 1.5:

free memory - the amount of free memory in the Java Virtual Machine. Calling the gc method may result in increasing the value returned by freeMemory.

max memory - the maximum amount of memory that the Java virtual machine will attempt to use.

total memory - the total amount of memory in the Java virtual machine. The value returned by this method may vary over time, depending on the host environment.