Eclipse MAT Parsing 11GB Heap dump - Out Of Memory. Unable to parse the heap dump - eclipse

I was trying to parse the 11GB heap dump using Eclipse MAT and I am getting the following error
An internal error occurred during: "Parsing heap dump"
I think the MAT is unable to parse such a huge heap dump. I read some posts and increase the VM configurations to more than 80% of the dump size. Following are my vm configurations
-vmargs -Xms8192m -Xmx10240m
and I am still not able to load the dump. I tried with ParseHeapDump.bat with no changes ...

Keep increasing Xmx till the JVM complains, then increase your swap file size, then increase Xmx again, etc.
At that stage it will take ages because it will be using disk as RAM.

I recently installed Eclipse MAT (Eclipse Memory Analyzer Version 1.9.1) on Mac OS Catalina (10.15.3). I needed to review a 4g heap dump. The default JVM heap size for MAT is 1024m.
I think the easiest way to increase the JVM's heap size is to use a shell window - go to the /Applications/mat.app/Contents/Eclipse/ folder. Then vi MemoryAnalyzer.ini and change -Xmx1024m to your required value, in my case I went with -Xmx10g.
To review the change, restart MAT and go to the help -> About Eclipse Memory Analyzer then click installation details, and look for the entry: eclipse.vmargs=-Xmx10g about 50 lines down.

This setup worked for me.
I also recently installed Eclipse MAT to analyze a 4.85GB heap dump file.
Eclipse Memory Analyzer Version: 1.11.0
MacOS Catalina: 10.15.7
Hardware Memory: 16GB
Heap dump file size: 4.85GB
Heap dump file type: PHD
Classes: 33.6k
Objects: 4.8m
Class Loader: 575
I changed the MemoryAnalyzer.ini to 14GB as follows:
-vmargs
-Xmx14g
I also confirmed the configuration as follows:
Help -> About Eclipse Memory Analyzer 1.11.0
Clicked on Installation Details
Clicked on Configuration tab
Looked for eclipse.vmargs=-Xmx14g.
It took some minutes to load this 4.85 heap dump file.
Note: I unsuccessfully tried Xmx setup with 2g, 4g, 8g, 10g, 12g - all failed with JVM out-of-memory in the Eclipse MAT tool.

On the Windows install of Eclipse Photon, I got around the problem by updating the memory parameters in the eclipse.ini file. This was directly under my c:\eclipse folder.
-Xms6g
-Xmx6g
I tried setting it to 4 gigs for a memory dump that was about 4.1GB and it failed. So, the rule of thumb is to set it to a higher value than the size of the memory dump.

Related

How to change runtime JAVA heap space in intellij IDEA on MacOS?

I'm getting Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
when running some main object in scala with IntelliJ Idea,
with the "^R" shortcut or Right click-> run 'mainObjName'
This program runs without problem if using sbt:
$ JAVA_OPTS="-Xmx4096m" sbt
sbt:prj> run mainobj
With the search results got from this site, I tried to set the heap space to 4096m in :
1.Preferences->Build Tools->sbt->Maximum heap size,MB
2.Preferences->Compiler->Build process heap size(Mbytes)
3.Preferences->Compiler->Scala Compiler->Scala Compiler Server->JVM Maximum heap size,MB
4.Preferences->Build Tools->Maven->Runner->VM Options (with -Xmx4096m)
But none of these works.
I'm running a memory hungry program, and this is clearly not a build time error but some thing happened during runtime.
So, How to change the maximum heap size for running a program in IntelliJ Idea?
btw, the program runs fine on linux workstation with much more memory, but seems the default heap size configuration is the same on the IntelliJ Idea on MacOS vs Linux. seems java consumes more memory on MacOS?
It seems, that all the options you've tried are setting the memory for various compiler facilities.
You could try to change the memory available for the runtime by setting the VM options to -Xmx4096m in the configuration you are running. You can find the configuration with your mainObjName under Run -> Edit Configurations... -> Application

IntelliJ IDEA consuming lots of CPU

I upgraded from IntelliJ IDEA from 12 CE to 13 CE few days ago and it has been hogging up CPU. Every few minutes it'll peak to 450-500% and then come down to 100-200%. Also, I've upgraded my Scala plugin to 0.30.380. Not sure what's causing the issue!?
I'm posting this comment by K P as an answer, because K P does not have enough reputation.
It just needed some more memory to prevent repeated garbage collection. I found the file idea.vmoptions [aka idea64.exe.vmoptions] and increased the memory for InteiiJ to run (Xms = 512m and Xmx = 2048). The CPU usage has come down to 0.2 - 10% when nothing is being done on it.
Go to your home folder, then navigate to .IntelliJIdea13\config\options
Edit the file project.default.xml by changing the VM_PARAMETERS Xmx and Xms as follows:
<option name="VM_PARAMETERS" value="-Xmx2048m -Xms512m -XX:MaxPermSize=250m -ea" />
It decreased the CPU usage to 50%.
Try clean up cache and restart. In Intellij 14 go to menu File -> Invalidate Caches / Restart...
As other said,increasing memory heap of IDEA is work, my IDEA version is 2016.3.4, following is setting way
Do one of the following:
Use the main menu command Help | Edit Custom VM Options to create a copy of the idea.vmoptions file in the user home. Refer to Edit Custom VM Options for details.
Copy the existing file from the IntelliJ IDEA installation folder somewhere and save the path to this location in the environment variable IDEA_VM_OPTIONS.
Copy the existing file /bin/idea.exe.vmoptions or /bin/idea64.exe.vmoptions from the IntelliJ IDEA installation folder into the location under your user home.
If anyone's wondering the "right" way to edit the idea.vmoptions or idea64.vmoptions file, here it is: https://www.jetbrains.com/idea/help/tuning-intellij-idea.html
On *NIX, you want to copy
<IntelliJ IDEA installation folder>/bin/idea64.vmoptions
to:
$HOME/.IntelliJIdeaXX/idea64.vmoptions
and edit that file to increase the heap memory for IntelliJ IDEA
(OP's example settings: Xms = 512m and Xmx = 2048)

How can I use Eclipse Memory Analyzer Tool to dump the heap from a running process?

I created a simple console application that I run from Eclipse (right clicking on the file and selecting run as Java application.) I stuck a sleep in there so I can ensure that the process is still running when I start the Aquire Heap Dump Dialog. I start the dialog, hit refresh, and there are no local processes listed.
I checked Eclipse's error log and it only reports that it had problems listing the IBM VM processes (the HPROF one is configured and working fine.)
What am I doing wrong?
Why not create the heap dump from your program code?
https://blogs.oracle.com/sundararajan/entry/programmatically_dumping_heap_from_java
Or when that runs into security issues from here:
create heap dump from within application, without HotSpotDiagnosticMXBean
I used that to take a heap dump after a fixed number of iterations in my JUnit tests, all that is left to do is open the dumps in Eclipse MAT and find the cause of the memory leak :-(
I faced same issue and after googled I found this solution.
Specify jdk path in "Acquire Head Dump" -> "Configure..." -> Select "HPROF jmap dump provider" -> "-jdkhome" -> speficy jdk path by default it should be
"C:\Program Files\Java\jdk1.8.0_102" or your jdk location.
I hope it works for you.

Eclipse uses 100 % CPU randomly

My eclipse sometimes starts using 100 % of my CPU very spontaneously.
I can't figure out why it needs that much CPU usage. There is no background task like "building workspace" running.
After some time the CPU load drops to 0 and everything is normal.
I can't find any information related to the problem in workspace/.metadata/.log file.
Has anybody some tip how I can figure out which part of eclipse is using the CPU so heavily? Is there a way to get a thread dump of eclipse? The kill -3 on the eclipse process doesn't do anything.
Eclipse Version: Galileo JavaEE
Operating System: Linux 2.6.31
Sounds like garbage collection
You could try changing the settings in your eclipse.ini, maybe with a higher Xmx value
--launcher.XXMaxPermSize
256m
-vmargs
-Xms256m
-Xmx1024m
-XX:PermSize=64m
-Xss1M
-server
-XX:+DoEscapeAnalysis
-XX:+UseConcMarkSweepGC
You can use visualvm to profile eclipse, get a heap dump or a thread dump, see which threads are running, etc.
If anyone else is having this problem, I fixed it for myself.
Set the option "auto build project" to off. That should remove a lot of the CPU used by Eclipse.
For my installation, I noticed the heap status indicator (Enabled VIA Window>Preferences "Show heap status" under General) was displaying less max heap than allocated in eclipse.ini (the -Xmx setting). The status indicator was bouncing around indicating that garbage collection was struggling to keep memory low.
Increasing the initial/min heap size (the -Xms setting) seems to have caused Eclipse/Java to stop trying to manage memory as much.
Eclipse is loading and unloading information from memory whenever this is required. If you workspace is big and you work with multiple projects and also your eclipse is configured to use low ammount of memory this is normal. Someone suggested above to change the xmx and xms values so that your eclipse uses more memory (if you have available) I suggest u put the same value to both of them. For example -Xms4048m and -Xmx4048m (or more) in your eclipse.ini file. This way your system will attempt to make use of that space once you start your IDE and the Garbage Collector (GC) takes less time to process data.
For me, the solution was to give Eclipse fewer threads. From my really long answer here:
Solution: decrease the max number of threads Eclipse can use, down to 1/2 as many as your computer has. So, if your computer has 8 physical "cores" (actually: hyperthreads), then decrease the max number of threads that Eclipse can use to 4, or <= half of your number of cores for your system, as follows:
In $HOME/eclipse/cpp-2022-09/eclipse/eclipse.ini on Linux Ubuntu, or equivalent for your OS, make this change (reducing from 10 threads max, to 4, in my case):
Change from:
-Declipse.p2.max.threads=10
to:
-Declipse.p2.max.threads=4
Restart Eclipse.
Now, Eclipse can only take up to 4 of my 8 threads, and my system runs much better!
Read my long answer for more details and other changes I made to help: High CPU usage in Eclipse when idle

Out of Memory error starting JBoss with Portal from Eclipse

I cannot get JBoss Portal to start from Eclipse, though the AS alone starts fine, and the Portal starts correctly as well, when started from the command line as opposed to from within Eclipse. I'm running in Windows, with 3GB. Suggestions? Thank you.
I've spend hours to discover this, and almost gave up and started to use JBoss out of Eclipse.
In order to increase your JBoss vmargs when starting it from Eclipse you have to change JBoss launch configuration. If you change standalone.conf, nothing happens because Eclipse doesn't use it.
So, to change JBoss vmargs in Eclipse, you have to go to "Servers" tab, right click on your Jboss instance, and select "Open".
It will appear a new window. In the first section, you have a option: "Open launch configuration". When you click there, you'll see the textbox to change vmargs.
Hope this helps you!
There are different types of OutOfMemory errors:
java.lang.OutOfMemoryError: Java heap space
Increase the -Xms and -Xmx. I'd make sure they are set at least 256m and generally it's a good idea to set them to the same value.
java.lang.OutOfMemoryError: PermGen space
Add either -XX:+CMSPermGenSweepingEnabled or increase the PermGen size: -XX:PermSize=256m
java.lang.OutOfMemoryError: GC overhead limit exceeded
Add more heap, the garbage collector can't free enough memory with each cycle. Also try turning on GC logging.
java.lang.OutOfMemoryError: unable to create new native thread
Decrease your heap :) This means that you have too much memory allocated to the heap that the OS doesn't have enough memory to create threads..
Two last things, the above can be configured in jboss/bin/run.conf.
Also when starting JBoss see what -X parameters are being passed to the JVM, it prints this information by default, verify that it's what you expect it to be.
You need to increase the memory you're allocating to Java, in particular heap space and PermGen. This article is highly relevant. It mentions that this issue often occurs with Eclipse and JBoss (since both are fairly large), and provides a solution (adjusting the command-line flags).
What are you using for running portal from eclipse? Maybe Jboss tools can help you
http://www.jboss.org/tools
According to my experiments, all options of vmargs set in eclipse.ini, plays only once - when creating a new workspace. When you want to change the options in the existing workspace, use run/debug configuration as in https://stackoverflow.com/a/10814631/715269. vmargs in ini won't be read any more.
Be careful, you should set -XX:MaxPermSize=...M, not -XX:PermSize=..., the last sets minimal, starting PermSize.
ad. Jeremy. It is senseless to put mins and maxs to the same value. You deprive Eclipse of adaptability. -Xms and -Xmx ( heap) and PermGen and MaxPermGen should be different. (MaxPermGen =256 by default)