How do I run stand-alone Eclipse MAT? - java

I generated hprof using jmap.
sudo ~/jdk/bin/jmap -F -dump:file=app.hprof 5003
Now, I am getting OOM / 'Java Heap Space' error while parsing *.hprof in eclipse. I think I need to run it as stand-alone.
How do I run it? any references?

I assume, you've downloaded Eclipse MAT in the form of Standalone Eclipse RCP Application. If not - do so now, and extract the archive to a folder that suits you.
You're getting the OOME, because MAT has too few memory available (the heap-dump you're parsing is too big).
To make the heap bigger, edit your MemoryAnalyzer.ini file (it should be in your MAT directory), and add the following lines to it:
-vmargs
-Xmx2048M
The 2048M means 2 gigabytes of heap space will be available to the JVM. Perhaps 1 gigabyte will be enough for you.
Note!
If you are using MAT as an Eclipse plugin, you can probably do the same trick by editing eclipse.ini in your Eclipse directory.

Related

JAVA does not work with the same resources on Netbeans Project and JAR file when the compile the code

When I build the Project and run the program on netbeans, it runs perfect and fast enough, yet when I export the jar file and start the program on that it is slow and stuck at the middle of the process.
I track the java resource usage and I found the memory problem.
How can I overcome this problem? I want to use the program same as on the Netbeans. How can I remove the constraint to resource usage of JAVA?
I am sorry, I forgot to tell I tried that. I think heap size is different than what I need. -Xmx and -Xms does not work. They don't change the java.exe or javaw.exe memory usage. I need what the Netbeans do to use more ram.
All pictures shows that the problem clearly.
Netbeans runs the program on java with more ram:
When the process parse and write to excel started it use so much ram:
However, when I start the program on JAR file, process so slow and use limited ram:
At the end of the process (parse and write to excel) it was very slow and after a while it stuck because of the lack of memory space that java allows:
If you are sure that memory limit is the only problem then set the maximum heap size that JVM can use, add -Xmx2G command line parameter to java.exe.
You can read more on -X options here.
Problem solved, but I don't know why JDK 1.8 block the memory usage?
Answer : http://forums.netbeans.org/viewtopic.php?p=167390

Intellij IDEA won't start

When I open Intellij 14 , it starts the initial loading and then following is shown in the screen.After that it is vanished and program does not start.
But when I open the task manager it is shown in the Processes as per the below figure.
Sometimes the program starts after about 10 minutes .Sometimes it won't start at all.Can someone give me a solution on how to overcome this problem ?
Just like Tom, I too have increased the memory when IntelliJ asked and regretted it. This is the screen that asked for it:
However, in my case, instead of editing the .vmoptions files in the bin folder, IntelliJ created a new one in my home directory which I can only assume overrides the ones in the bin folder. I would assume this is typical of the new versions - I am using IntelliJ 2016.1 right now.
So, in order to fix this issue, go to C:\Users\<your_username>\.IntelliJIdea<version>\config (or your OS' equivalent) and delete the idea.exe.vmoptions and/or idea64.exe.vmoptions file from there. This should remove the override and have IntelliJ use the settings in the bin folder.
It might be worth checking the files in the bin folder as well, in case IntelliJ changes how it handles these settings.
Here are the default .vmoptions files in the installation's bin folder; you can't delete these as it will prevent IntelliJ from starting:
bin/idea.exe.vmoptions:
-server
-Xms128m
-Xmx512m
-XX:MaxPermSize=250m
-XX:ReservedCodeCacheSize=150m
-ea
-Dsun.io.useCanonCaches=false
-Djava.net.preferIPv4Stack=true
-Djsse.enableSNIExtension=false
-XX:+UseConcMarkSweepGC
-XX:SoftRefLRUPolicyMSPerMB=50
bin/idea64.exe.vmoptions
-Xms128m
-Xmx750m
-XX:MaxPermSize=350m
-XX:ReservedCodeCacheSize=225m
-ea
-Dsun.io.useCanonCaches=false
-Djava.net.preferIPv4Stack=true
-Djsse.enableSNIExtension=false
-XX:+UseConcMarkSweepGC
-XX:SoftRefLRUPolicyMSPerMB=50
I got an out-of-memory dialog on intellij 15 and took an option on that dialog to increase max memory. Thereafter I could not start intellij. So, I looked in the intellij /bin folder for a pid file (per another stack overflow question) to see what was happening, but I could not find one. There was however a file (idea.exe.vmoptions) that had changed (to hold my new memory setting). So I edited that file to set max memory back to what I had before, and now it works.
You can try to open Intellij on CLI.
cd C:\Program Files\JetBrains\IntelliJ IDEA 2020.1\bin
later then execute this command
idea.bat
Probably Intellij will open. If it will not open then you can see the error message why it will not open on CLI.
Just updated IntelliJ to a newer version, and I followed the 'configure' link to double the memory used for IntelliJ which I later regret. IntelliJ could not restart. Open the system.log (e.g. Use CMD+SPACE_BAR and search 'console' on MacOs, then go to system.log), I can see IntelliJ aborted a few times with an abnormal code 1. Here the lines related to the launch,
Processing VMOptions file at
/Users/[user]/Library/Preferences/IntelliJIdea2019.2/idea.vmoptions
com.apple.xpc.launchd[1] (com.jetbrains.intellij.22016[2971]): Service exited with abnormal code: 1
I can see the path from where IntelliJ loads vm options during the launch.
Checking the bin/ of my IntelliJ application, I can see another version of the idea.vmoptions file that has a slightly older timestamp. By comparing the content of the two files, I now realized that IntelliJ created another vm option file that has only a sub set of options in a newer location which broke the restart. Deleting or just safely renaming the newer file in the [User] sub directory fixed my problem.
C:\Users\<user>\AppData\Roaming\JetBrains\
if you are a Windows user, remove this directory. It helped me
Edit C:\Program Files (x86)\JetBrains\IntelliJ IDEA 15.0.6\bin\idea.exe.vmoptions the Xmx to Xmx512
-server
-Xms128m
-Xmx512m
Following steps helped me to overcome the Java heap size related issues on InteliJ IDEA.
Go to the location where you have installed the IDEA IDE and search for the following file:
idea64.exe.vmoptions
Change it accordingly.
-Xms4196m
-Xmx8092m
-XX:MaxPermSize=1000m
-XX:ReservedCodeCacheSize=1024m
-ea
-Dsun.io.useCanonCaches=false
-Djava.net.preferIPv4Stack=true
-Djsse.enableSNIExtension=false
-XX:+UseConcMarkSweepGC
-XX:SoftRefLRUPolicyMSPerMB=50
Also be aware of the 32-bit address space limit on Windows which makes it hard to use heap sizes higher than 750m. Should you need to use larger heap, make sure to switch to the 64-bit JVM first, otherwise IDE may crash on start or start to crash randomly during work.
For me, the cause was a bad plugin.
I moved all plugins in below directory to a backup directory, and started IDEA, and it started without an issue.
C:\Users\<username>\AppData\Roaming\JetBrains\IntelliJIdea2021.2\plugins
Then, copied plugins back to the above directory one by one, to identify the broken plugin.
You might also check your IDEA_JDK_64, JAVA_HOME and JDK_HOME environmental variables. In my case I updated Java version and deleted previous directory containing JDK. Then IntelliJ started to dissapear from processes just a few seconds after launch. I changed all paths to point proper JDK directory and then it started to work as it should.
Check the logs for error or issue in the path C:\Users\.IntelliJIdea14\system\log\idea.log.
If that report HeapDumpOnOutOfMemoryError
Go to VM options files in the path C:\Program Files\JetBrains\IntelliJ IDEA 2018.2.6\bin
Increase the -Xms750m to greater value say -Xms900m .
That solve the issue for me
Had a similar issue.
idea64.exe just didn't start silently.
idea.bat printed just IDE is being shut down and didn't start either.
In my case there was no effect of manipulations with idea64.exe.vmoptions, but it helped to find and kill from Task Manager an invisible orphan idea64.exe process.
This solution was hinted by the first comment by #CrazyCoder at https://intellij-support.jetbrains.com/hc/en-us/community/posts/360009511720--Solved-Idea-Community-doesn-t-start-after-update-to-2020-1-4.

NetBeans Low on Memory Error

I am new to this kind of error in Netbeans. I have been working in Java J2SE using my net beans 8.0.2. I am doing Fuzzy Search on Strings usually strings having 300-500 length. I am using Levenshtein and Jaro Winkler Algorithms to find the Distance between the strings.
There are about 1500 iterations to find the distance between the strings!
The problem is that my net beans often gives error for:
Low on Memory, Error Unable to Compile
I have done some search online to get rid of this error and found how to increase the heap size by adding
-Xms3G
command means to give 3GB space for the heap! but the error still comes up in the compilation process and project run in net beans.
Can somebody help me out how to get rid of this error because when it happen i got this error
java.lang.noClassDefError
Please help me getting rid of this error I am a newbie for this error!
With -Xms3G, it means that your JVM will be started with Xms amount of memory, the initial memory allocation.
But instead use -Xmx3G which will be able to use a maximum of Xmx amount of memory, the maximum memory allocation.
1.Netbeans Heap Size
If you want to increase the NetbeansIDE heap size, then edit the following file.(the etc folder from your Netbeans installation dir)
C:\Program Files\NetBeans\etc\netbeans.conf
Find the following line and add -J-Xmx3G, you can specify any size. I have provided 3G for eg.
netbeans_default_options="-J-client -J-Xss2m -J-Xms32m -J-Xmx3G -J-XX:PermSize=32m ......."
2. Project settings for running a project by increasing Heap size from Netbeans
Right Click Project -> Properties -> Run -> VM Options -> Customize Button.
You will find many options for VM, specify value for Xmx.
3. Run a jar file by providing VM options to increase heap size, outside of Netbeans.
Run form command line or write a script.
java -Xmx3G -jar filename.jar
Hope this may help.
The simplest answer for my problem was a trick to identify. I had a number of netbeans projects into my working directory. Suppose that my directory D:\NetBeans\WorkSpace contains about 300 projects!
What I done is that simplify the directory moved the old projects into a new directory and only a few projects left into my netbeans working space.
The error message goes off after moving a number of projects into a new directory.
The thing is when netbeans starts up it loads the projects into the memory and if you have a lot of projects into the loading directory it will cause to leak the memory!
Allocate more memory for NetBeans.
Go to your NetBeans home directory.
Open the netbeans.conf file in the etc directory. //under:Resource/NetBeans/etc
Find the netbeans_default_options parameter in the file.
Set the -J-Xms and -J-XX to larger values. ex:-J-Xms256, -J-XX256
Hope for help.

Application runs in Eclipse, exported jar crashes

Inside my Swing application I have to parse xml documents. Sometimes they have more than 190 MB. It caused crashes in applications because no enough memory could be allocated. Inside Eclipse I changed JVM arguments so it can allocate up to 2gb of memory using this argument:
-Xmx2048m
When I start it like this there are no problems.
But when I exported it to runnable jar file app keeps crashing. I changed the JVM memory settings for my Windows environment
ControlPanel->Programms->Java->Java-View
It crashes at the following line:
doc = docBuilder.parse(inputSource);
But no exception is thrown. For this reason I think my JVM crashes. What could be the problem?
Create a BAT and double-click that instead of your JAR.
MyApp.bat:
# echo off
java -Xmx2048m -jar MyJar.jar
Or better yet, wrap the JAR in an EXE that also sets the JVM parameters. A tool like Launch4J can do this.

OutOfMemory in Eclipse in a Launched process

I have an OutOfMemory (heap size) in eclipse using a third party plugin
The plug in is Adobe Livecycle work bench and during the out of memory the
plugin is retrieving via WS (using Axis) a list of around 70 workflow components
on my server
Here is a extract of my call stack in Eclipse
... at org.eclipse.equinox.launcher.Main.main(Main.java:1144)
Caused by: java.lang.OutOfMemoryError: Java heap space; nested
exception is: java.lang.OutOfMemoryError: Java heap space at
org.apache.axis.message.SOAPFaultBuilder.createFault ...
I am using this eclipse.ini
-showlocation
-vm
C:\bea920\jdk150_04\bin\javaw.exe
-vmargs
-Xms512M
-Xmx1024M
I don't use any commandline options
I have added -Xmx1024m to my only Installed JRE in Java/Installed JREs
It seems to me that :
-eclipse is not OutOfMemory itself
it displays only 300Mo out of 1024Mo used
it continues working properly
-the plugin launch its axis parsing without giving it enough memory
Questions :
- Are my suppositions right ?
- How do I find where and how to give more memory to the process launched by eclipse launcher ?
Have you changed your launched VM arguments from the preferences window? Try this:
Window->Preferences
Java->Installed JREs
(select your jre here)->Edit..
Default VM Arguments: -Xmx1024m (or whatever size you like)
Edit 1: Based on your comments, I see that you've already tried this. I assumed that you did not try it based on the portion of your question that reads "How do I find where and how to give more memory to the process launched by eclipse launcher ?". I guess we all know what happens when we assume!
Have you considered upping the memory to something larger just to see if you can get it to run (and possibly get some more info about what is causing it to crash)? Try -Xmx2048m or larger depending on your available memory.
Can you add some information to your question that gives us an idea of what the plugin does? Is this project a web service? etc..
See if you are passing Xms and Xmx options in the command line that you are running eclipse with. The values there will override the values in the eclipse.ini
I think you need to edit your eclipse.ini file which is located in the
same directory as your eclipse exe file. It will contain the -Xms settings
which you can then change.
I recommend running eclipse with the -clean option to purge any caches and re-read your settings.
Also, I've had success moving the eclipse.ini out of the eclipse directory (so there's no eclipse.ini), running eclipse, exiting, moving the ini file back and running again. I didn't bother to try to understand why that helped.
Add -XX:MaxPermSize=256m
This is yet-another-memory-type in Java.
I was able to find were the problem is
I used Fiddler with eclipse (using proxy settings)
This way I was able to spot that the soap answer was an OutOfMemory
soapenv:Fault
faultcode soapenv:Server.generalException
faultstring java.lang.OutOfMemoryError: Java heap space; nested exception is:
java.lang.OutOfMemoryError: Java heap space
So the problem was on the server
I have now another problem : the server builds an answer which is to big for eclipse
Thank you for your answers

Categories

Resources