Profile your eclipse plugins with SAP Memory Analyzer part 1
After quite a long time browsing the web i finally found a way to profile my Eclipse plugins using SAP Memory Analyzer. In fact i had troubles to generate an on demand memory dump to the JVM running Eclipse. It was easy to generate a memory dump on OutOfMemoryErrors using a simple jvm parameter but not so easy to have this dump at any time. Using jconsole 1.6 you can have this dump when you want
Here is the procedure i am using to analyze the JVM memory content of a running Eclipse :
0- You need : SAP Memory Analyzer (free registration required) and a JDK 6.
1- Set your Java environment (jconsole.exe + java.exe) to a JDK 1.6 (new jconsole tool and new com.sun.management mbean are required)
2- Edit your eclipse.ini file and add the following bold lines :
-vm /home/selvam/Softs/Java/jdk1.6.0_04/bin/java (path to a java.exe 1.6 to force Eclipse to create a new java.exe process)
-vmargs
-Dcom.sun.management.jmxremote (To start Eclipse with the management agent for local monitoring, MUST be added after -vmargs)
-Xms40m
-Xmx512m
3- Launch Eclipse
4- Launch jconsole.exe
5- You should see the process corresponding to the previously launched Eclipse (if not be sure to have correctly perform steps 1,2 and 3). Connect to this process.
6- Go to the Mbeans tab and to com.sun.management / HotSpotDiagnostic / Operations (No com.sun.management entry displayed means that the underlying JVM is older than 1.6)
7- Enter the full path of the memory dump file to generate in the first argument slot and then click dumpHeap button. Warning - The file name must have .hprof extension in order to be opened with SAP Memory Analyzer. After few seconds (depending on the size of your JVM memory heap) you should receive a confirmation message.
8- Finally, you just have to open the generated file with SAP Memory analyzer and have fun !!!!

January 22, 2008 at 1:30 pm
What the fuck, it does not work at all !!!
;o)
January 23, 2008 at 7:43 pm
Hi Denis,
I tryed on a windows computer and it works !! Have you try with another windows environment ?