Can one monitor the internal memory allocation within a JVM via perfmon or top ?

book

Article ID: 159754

calendar_today

Updated On:

Products

Data Loss Prevention Network Monitor

Issue/Introduction

Can one monitor the internal memory allocation within a JVM via perfmon on Windows or top on Linux?

Resolution

Windows perfmon or the Linux top command lets you only monitor the only the Java process itself, not the internals such as the Java heap memory allocation and so forth. In general, if you would want to use perfmon to monitor Java process internals you would require to use an extension DLL to the performance monitor and communicating with that via a memory mapped file. (see as reference http://www.developer.com/java/data/article.php/3087741 )

However, this is nothing we do at the moment for performance reasons and it is more efficient to hook a debugger directly onto the JVM during debugging and development time then to invest in implementing such a hook into our product.

 

In short, perfmon and other monitoring tools such as top, would only let you monitor the overall system and JVM behaviour, but not the executed Java programs and memory usage within the JVM adequately. However, what they can do alternatively is to enable JVM native and use one of the following JVM arguments to monitor memory behaviour.

 

-XX:+PrintGCDetails

-XX:+PrintGCTimeStamps 

-Xloggc:memlog.txt

-XX:+PrintTenuringDistribution  

-XX:+HeapDumpOnOutOfMemoryError  

 

More can be found in http://www.oracle.com/technetwork/java/javase/tech/vmoptions-jsp-140102.html

But keep in mind that these settings and the gathered information would be unsupported.

If there are memory problem that need to be addressed it would be highly recommended to open a support ticket to address any questions at that point.