HOME
> System software
> Eclipse: Using Memory Analyzer - How To Save Space
Eclipse: Using Memory Analyzer - how to save space
With Eclipse you create various Java programs. For this, the development environment offers you numerous functions that make programming easier. Since Java programs in particular can quickly become memory-intensive, it is worth using Eclipse's Memory Analyzer, which shows you various weak points.
How to use the Memory Analyzer in Eclipse
You can use the Memory Analyzer (MAT) to detect memory leaks in your Java program. Before this is possible, however, you need to install the feature.- Go to "Help" and then to "Eclipse Marketplace".
- Enter "MAT" in the text field for the search.
- Then click "Install" on the corresponding entry.
- Open the Java project that you want to evaluate.
- Now create a subfolder within your project with "New" > "Folder", in which the MAT files are stored.
- Go to "Run". For this, press the small arrow next to the icon.
- Then click on "Java Applications" > "Start" > "Arguments" under "Run Configurations".
- Here is the field "VM Arguments". Under VM Arguments now add the parameters "-XX:+HeapDumpOnOutOfMemoryError" and "-Xmx(MEMORY)m".
- In place of (MEMORY) write how many Mbytes your program may consume maximum.
- If you want to evaluate the examination afterwards, go to "Window" > "Perspective" > "Open Perspective" > "Other" > "Memory Analysis".
- Under "Open Heap Dump" you can now open the corresponding "Heap Dump File" with all the information.