Posts

Image
Eclipse MAT OQL: Gathering Basic Information from Heap Dump All Environment Variables used by JVM process SELECT map.key.toString() AS key, map.value.toString() AS value FROM OBJECTS ( SELECT OBJECTS o[0:-1] AS kv FROM OBJECTS ( SELECT OBJECTS c.theEnvironment FROM java.lang.Class c WHERE (c.@displayName.contains("class java.lang.ProcessEnvironment") and (c.theEnvironment != null)) ) o ) map All System Properties used by JVM process SELECT map.key.toString() AS key, map.value.toString() AS value FROM OBJECTS ( SELECT OBJECTS o[0:-1] AS kv FROM OBJECTS ( SELECT OBJECTS c.props FROM java.lang.Class c WHERE (c.@displayName.contains("class java.lang.System") and (c.props != null)) ) o ) map Heap Dump Epoch time SELECT c.CURRT AS HeapDumpEpochTime FROM java.lang.Class c WHERE c.@displayName.contains("class sun.util.calendar.ZoneInfoFile ") Then copy the value displayed and use a site such as  https://www.epochconverter.com/  to convert it to Human Readable time...
Image
Eclipse MAT OQL  OQL for flattening string array Consider a class whose instances can contain an array of strings which we want to display as output of an OQL. For example, let's say X, Y are two instances of the class and say, X has [Xs1, Xs2] as that array of strings and Y has [Ys1, Ys2, Ys3]. We want to find an OQL which would have output like this: InstanceName Strings ---------------------------- X                          Xs1, Xs2 Y                          Ys1, Ys2, Ys3 With current artefacts available with Eclipse MAT OQL, it seems to be impossible to show that. But it is possible to formulate a simple query which has output as below: InstanceName Strings ---------------------------- X                     Xs1 X           ...
Image
Eclipse MAT OQL  Eclipse MAT is a prominent tool for analyzing heap dumps collected from a Java process. It has the usual features which we can expect while processing data that can be unearthed from a heap dump. We can see a Histogram which shows names of all classes loaded in the JVM along with their number of instances and cumulative heap size occupied by them. We can view list of all instances of a class, their static data members along with data members associated with each instance. We can dig deeper into any such data member. We can see all references incoming or outgoing in reference to an object. It is easy to see reference tree till "GC root" for one instance or merged over multiple/all instances of a class. We can see top dominators and suspects for memory leaks using this tool. We can list all threads used by the JVM, and inspect them for their stack traces and objects associated in context of code-lines there. It is possible to review all elements of any collecti...