Free Memory information (without using getStats)

Hi,

I need to collect free memory information on number of services in a development environment. I know that getStats service can be used to get this info.

Let me clarify a little, there is a system database where all the information is stored (amount of free memory on a server too, it is collected every number of milliseconds automatically by IS).

Dmitry,

The total and free memory statistics are collected from the JVM as a follows.

totalMem: java.lang.Runtime.totalMemory() / 1024
freeMem:

Runtime rt = Runtime.getRuntime();

String total = String.valueOf(rt.totalMemory());
String free = String.valueOf(rt.freeMemory());
String max = String.valueOf(rt.maxMemory());

// open a cursor for the pipeline
IDataCursor pipelineCursor = pipeline.getCursor();

IDataUtil.put( pipelineCursor , “TotalMemory”, total);
IDataUtil.put( pipelineCursor , “MaxMemory”, max);
IDataUtil.put( pipelineCursor , “FreeMemory”, free);

pipelineCursor.destroy();


This is a simple java service to retrive total memory used, free memory available, and more nicely, the Xmx parameter (MaxMemory)