OutOfMemory in Eclipse in a Launched process - java

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

Related

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.

How do I run stand-alone Eclipse MAT?

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.

Help setting up Java VM size

Well I am very new to Java and can't understand how am I supposed to set the virtual machine's size. I've built a small web applet that displays images. Sometimes the images can be pretty large, when this happens I get:
*Exception in thread "Image Fetcher 0" java.lang.OutOfMemoryError: Java heap space*
I've been trying to follow different instructions that I found on the Internet and have finally created this shortcut to Eclipse with the following command-line:
"C:\Documents and Settings\Dror Well\Desktop\temp\Eclipse\eclipse\eclipse\eclipse.exe"
-vmargs -vm "C:\Program Files\Java\jdk1.6.0_14\bin"
\"C:\Program Files\Java\jre6\bin\javaw.exe" -Xms256m -Xmx1024m
What am I missing? How should this be done?
In that line you have set the VM args to the Java process that Eclipse runs in. What you need to do for your application is to set the -Xmx512m (or however big you want it to be) for the application that you are running. You can do this from the Run dialog.
From the Run menu, choose 'Open Run Dialog'. In there, you should see on the left side a list of programs. If you have run it once already, yours should be listed in the Java Applications node. Select it and on the right panel, go to the Arguments tab. There will be a VM Arguments text box. Enter your -Xmx arg there.
The parameters should be passed to the JVM running your application, not the one running Eclipse. Try looking through the debug settings in Eclipse, there should be some place to put the -Xmx and -Xms parameters.
Since the images can be pretty large, you should look at the following alternatives:
Allocate more memory to the Java executable that will be launched by Eclipse (not Eclipse itself). This can be done via the VM arguments for the runtime configuration that you use to run the application in Eclipse.
Switch to the parallel garbage collector, using the -XX:+UseParallelGC flag for the application (again, this is not for Eclipse). This wont help if you have large objects retained in memory for a long period of time.
For Eclipse you need to update the eclipse.ini file in order to set any JVM properties. Full details on where the file is and how to update it this link.

java.lang.OutOfMemoryError: Java heap space with NetBeans

This is the error I get when I run my web application in an instance of the Tomcat servlet container started by NetBeans. To fix this I even changed the heap size in netbeans.conf, but still it shows the same error. How can I keep this from happening?
HTTP Status 500 -
--------------------------------------------------------------------------------
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Servlet execution threw an exception
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:362)
root cause
java.lang.OutOfMemoryError: Java heap space
note The full stack trace of the root cause is available in the Apache Tomcat/5.5.9 logs.
Changing the heap size in netbeans.conf only changes the heap for NetBeans itself, not for applications run through NetBeans.
The correct way is to right-click on the project and select "Properties" and then "Run"; there you can set the VM options appropriately (-Xmx256m, for instance). It should look something like this:
(Thanks to VonC for finding this picture.)
Stop Tomcat server, set environment variable CATALINA_OPTS, and then restart Tomcat. Look at the file tomcat-install/bin/catalina.sh or catalina.bat for how this variable is used. For example,
set CATALINA_OPTS="-Xms512m -Xmx512m" (Windows)export CATALINA_OPTS="-Xms512m -Xmx512m" (ksh/bash)setenv CATALINA_OPTS "-Xms512m -Xmx512m" (tcsh/csh)
In catalina.bat or catallina.sh, you may have noticed CATALINA_OPTS, JAVA_OPTS, or both can be used to specify Tomcat JVM options.
What is the difference between CATALINA_OPTS and JAVA_OPTS?
The name CATALINA_OPTS is specific for Tomcat servlet container, whereas JAVA_OPTS may be used by other java applications (e.g., JBoss). Since environment variables are shared by all applications, we don't want Tomcat to inadvertently pick up the JVM options intended for other apps. I prefer to use CATALINA_OPTS.
How to set java heap size in JBoss?
Stop JBoss server, edit $JBOSS_HOME/bin/run.conf, and then restart JBoss server. You can change the line with JAVA_OPTS to something like:
JAVA_OPTS="-server -Xms128m -Xmx128m"
How to set java heap size in Eclipse?
You have 2 options:
Edit eclipse-home/eclipse.ini to be something like the following and
restart Eclipse.
-vmargs-Xms64m-Xmx256m
Or, you can just run eclipse command with additional options at the
very end. Anything after -vmargs will be treated as JVM options and
passed directly to the JVM. JVM options specified in the command
line this way will always override those in eclipse.ini. For
example,
eclipse -vmargs -Xms64m -Xmx256m
How to set java heap size in NetBeans?
Exit NetBeans, edit the file netbeans-install/etc/netbeans.conf. For example,
netbeans_default_options="-J-Xms512m -J-Xmx512m -J-XX:PermSize=32m -J-XX:MaxPermSize=128m -J-Xverify:none
How to set java heap size in Apache Ant?
Set environment variable ANT_OPTS. Look at the file $ANT_HOME/bin/ant or %ANT_HOME%\bin\ant.bat, for how this variable is used by Ant runtime.
set ANT_OPTS="-Xms512m -Xmx512m" (Windows)export ANT_OPTS="-Xms512m -Xmx512m" (ksh/bash)setenv ANT_OPTS "-Xms512m -Xmx512m" (tcsh/csh)
If you increase the virtual memory of your Tomcat server then it will be OK.
Steps:
In NB go through the windows menu and add Services
You will find Tomcat in the services. Right click on Tomcat server and select Properties
Go to the platform in the properties and write -Xms512m in VM options field
I'm guessing that increasing the memory won't fix the problem. What is that MonitorFilter doing? What's eating up all that memory?
Your best bet is to figure that out. If this is a web app, see if you can turn off that filter and run without it. If you have success, you know that the MonitorFilter is causing your to fail.
This has nothing to do with NetBeans (well, perhaps), rather it has to do with Tomcat. Tomcat is the process that is running out of heap, not NetBeans. Track down the startup process for your Tomcat. If it's bundled with NB, then Tomcat is buried within the NB installation, check for an "enterpriseN" directory, N being a number, Tomcat is probably in there and it's a rather generic distribution of it.
As to why the monitor is run OOM, that's hard to say, it's a pretty simple process when you think about it. You can also try disabling HTTP monitoring to see if it's a problem with the Monitoring itself or something with your application.

Categories

Resources