Search code examples
javaout-of-memoryheap-memoryheap-dump

Scanner program OutOfMemoryError & Java Heap dump analysis using Memory analyzer (MAT


I am trying to analyze a heap dump of my Java applet which runs out of heapspace even if i increase the heap size as shown in this post. Applet: Java heap space

Now i took some heap dumps today morning (yes..its possible to take digital dumps) and im trying to analyze them with MAT and Visual VM 1.3.5. After running the leak test, the key suspects were org.eclipse.jdt.internal.core.JavaModelManager and org.eclipse.jst.jee.archive.internal.ArchiveImpl.. I HAVENT USED ANY OF THESE IN MY CODE.

Visual Vm shows that the highest space is taken by Byte[], Int[], Char[], java.lang.string and short[] classes. I am not using too many of these in my program. How should i understand this dump and what should be my next steps? I can post a copy of the dump if needed.

Update: MAT is better than visual VM in my case here. I have been taking dumps (again.. digital dumps) and analyzing them with both tools since morning. While VVM shows org.eclipse.jdt.internal.core.JavaModelManager and org.eclipse.jst.jee.archive.internal.ArchiveImpl as the suspects in its leak suspect reports, Eclipse memory analuzer (MAT) shows that my swing application is making thumbnails of images in a folder (each image is about 100kb) and showing them as a JToggleButton. But once the thumbnails are added, the JtoggleButton size is 6MB.. hence if there are a 100 images in a folder, the thumbnails of the images will be 600MB atleast. and besides that, i need to do other stuff with this program.. MAT helped in this case to identify the exact objects that took most heap space.

Thanks DJ.


Solution

  • 1)I created the heap dump using Jconsole at different points of running the program, 2)Imported them into Memory analyzer 3)Ran a leak suspect report 4)observed the sizes of the biggest instances and the number of them. This showed me the problem and im trying to solve it and i dont know how .. yet. Atleast glad i found out about MAT and its definitely more helpful than Visual VM in my case. hope it helps someone else. below is the link to my next question.

    swing applet.. jtogglebutton size is 6mb. how can i reduce the size