Failed on starting Spring Tool Suite when I change XMx - java

I am trying to change and increase the default -Xmx768m to -Xmx1024 in STS.ini. However, on startup I get an error saying "Failed to create the JVM".
If I revert it back to 768 it works fine. Any idea as to what am I doing wrong and how can I improve the performance of STS?
Here is the configuration
-startup
plugins/org.eclipse.equinox.launcher_1.1.1.R36x_v20101122_1400.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.2.R36x_v20101222
-product
com.springsource.sts.ide
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
256M
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms256m
-Xmx768m
-XX:MaxPermSize=256m

You could try to attach the jvisualvm profiler tool (can be found in the bin folder of your jdk). If anything the tool will give you info about the jvm and its resource usage.
Be careful to use the tool that comes with the jdk you use for STS (most likely the one in JAVA_HOME but not necessarily).
Mind you that on a 32bit OS the JVM will never be able to get more than 1.6 GB of memory. If you have other software already in that same JVM as STS, jvisualvm will list them in the left side panel.

Related

Why my eclipse is running so slow

I don't know whats wrong with my eclipse. its running so slow.
it takes at least 10 minutes to open. when Start server it is also taking long time.I tried multiple way.
I am on Windows 7,
eclipse LUNA (4.4.0)
I am using maven and spring framework and running jboss server.
I have 8 GB of RAM.
my eclipse.ini look like that
-startup
plugins/org.eclipse.equinox.launcher_1.3.0.v20140415-2008.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.200.v20140603-1326
-product
org.eclipse.epp.package.jee.product
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
1024M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
1024m
--launcher.defaultAction
openFile
--launcher.appendVmargs
-vmargs
-Dosgi.requiredJavaVersion=1.6
-Xms1024m
-Xmx1024m
I have changed Xms and Xmx value from
-Xms128m
-Xmx128m
to this
-Xms1024m
-Xmx1024m
But I am having the same issue,
It was working fine but after few days it become slower and slower.
Please help.
Add -Xverify:none to your eclipse.ini file.
It will cut down your Eclipse startup time considerably.This will tell the VM not to validate all the .class files it is loading
try removing unwanted plugins from the eclipse.. since these plugins cause unnecessary memory consumption you will definitely see some improvement. I have faced this issue, after removing some plugins,my eclipse got real faster..
You can try the Eclipse plug-in 'Optimizer for Eclipse'. It really helped me to boost my Eclipse start-up.
It can update your settings by itself (change heap size, suggest the latest eclipse/jdk version, and more).
Link : https://zeroturnaround.com/free/optimizer-for-eclipse/
Disable unwanted plugins during startup.

Eclipse Failed to create the Java Virtual Machine

I'm using eclipse to develop android application and it always gone well, but today it's giving problems.
When i try to open eclipse it show me this message "Failed to create the java virtual machine. Error occurred during initialization of VM. Could not reserve enough space for object heap"
This is my eclipse.ini
-startup
plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.200.v20120913-144807
-product
com.android.ide.eclipse.adt.package.product
--launcher.XXMaxPermSize
256M
-showsplash
com.android.ide.eclipse.adt.package.product
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-vmargs
-Dosgi.requiredJavaVersion=1.8
-Xms1336m
-Xmx1336m
-Declipse.buildId=v22.3.0-887826
-XX:MaxPermSize=512M
I tried to change "256m" in "512m" but it still doesn't work. I tried to restart but nothing. I tried to change the -XX:MaxPermSize=512M value, but nothing.
Just add your JDK path in windows environment variable.
Open eclipse.ini and change the following variables.
For -Dosgi.requiredJavaVersion=1.8, try changing your required Java version to 1.6.
Memory-related defaults (as of Eclipse 3.4):
-Xms40m
-Xmx256m
-XX:MaxPermSize=256m
Recommended settings for Android development:
-Xms128m
-Xmx512m
-XX:MaxPermSize=256m
If everything else fails you can just delete or rename eclipse.ini and let the IDE handle everything. I strongly suggest looking for a current replacement for your eclipse.ini and reading up on how to configure the eclipse.ini for Android development.
Closed all the other memory intensive application in my windows7. And tried to
open eclipse. This worked for me, and I found it on similar question here Stackoverflow-eclipse failed to create JVM.

Eclipse Indigo typing lag on OS X Lion

I am working on a fairly large project and have recently bumped into the good old friend of mine from the 90's, typing lag.
My setup is MacBook Pro 2.2 GHz i7 8GB with SSD drive and it hasn't had any serious performance issues so far.
I have increased the memory allocations to -Xmx1024m and -XX:MaxPermSize=512m. There is no heavy use of plugins involved. Also, this only happens on .java files in the default editor.
What could be the problem?
EDIT:
I found the problem. I noticed that the problem occurred only when editing large java files. In my case the class had 1800 rows.
It's weird though, since I am not facing the same problem with the same eclipse setup on Ubuntu. It seems like Eclipse on Mac just can't handle java files that big I was editing.
Any suggestions?
EDIT2:
I am using the Eclipse Indigo for Java EE with the latest updates (3.7.1.X)
Installed plugins:
m2eclipse
MercurialEclipse aka HGE (1.9.1 from the official eclipse update site)
Subclipse (installed, but not used in the workspace where the typing lag occurs)
ADT (installed, but not used in this project)
All plugins are installed via Eclipse marketplace and are updated to the latest release unless stated otherwise.
Try altering the settings in your eclipse.ini file. This contain the settings for the JVM and can help reduce memory issues like this.
Example eclipse.ini:
-data
../../workspace
-showlocation
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
384m
-startup
plugins/org.eclipse.equinox.launcher_1.0.201.R35x_v20090715.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.0.200.v20090519
-vm
../../../../program files/Java/jdk1.6.0_17/jre/bin/client/jvm.dll
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms128m
-Xmx384m
-Xss4m
-XX:PermSize=128m
-XX:MaxPermSize=384m
-XX:CompileThreshold=5
-XX:MaxGCPauseMillis=10
-XX:MaxHeapFreeRatio=70
-XX:+UseConcMarkSweepGC
-XX:+CMSIncrementalMode
-XX:+CMSIncrementalPacing
-Dcom.sun.management.jmxremote
-Dorg.eclipse.equinox.p2.reconciler.dropins.directory=C:/jv/eclipse/mydropins
Detailed in this question and this question.
Jivings was right about the root of the problem being in the eclipse.ini file.
I am not sure what I have actually changed in the eclipse.ini after messing around with the it, since the TimeMachine does not seem to be able to save a backup of the .ini file inside the Eclipse application package (Eclipse/Contents/MacOS/eclipse.ini).
I actually lowered the MaxPermSize and other memory values which made Eclipse run smoother. If anyone else is encountering the same problem, I suggest you try similar values and see if that works. If it doesn't, I also read that you can start eclipse once with the -clean argument, which cleans up some installation and usage history among other things. I did not do that, but it's worth a try.
The following is my current configuration, and it works pretty well:
-startup
../../../plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar
--launcher.library
../../../plugins/org.eclipse.equinox.launcher.cocoa.macosx.x86_64_1.1.100.v20110502
-product
org.eclipse.epp.package.jee.product
--launcher.defaultAction
openFile
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-vmargs
-Dosgi.requiredJavaVersion=1.5
-XstartOnFirstThread
-Dorg.eclipse.swt.internal.carbon.smallFonts
-XX:MaxPermSize=256m
-Xms40m
-Xmx512m
-Xdock:icon=../Resources/Eclipse.icns
-XstartOnFirstThread
-Dorg.eclipse.swt.internal.carbon.smallFonts

Xmx is 3072m but Runtime.getRuntime().totalMemory() returns 59mb

I am using eclipse EE in ubuntu by downloading the .tar.gz file from eclipse website and extracting in my home directory. I set the -Xmx to 3072m in the eclipse.ini. Here it is:
-startup
plugins/org.eclipse.equinox.launcher_1.1.0.v20100507.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.1.R36x_v20100810
-product
org.eclipse.epp.package.jee.product
--launcher.defaultAction
openFile
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-vmargs
-Dosgi.requiredJavaVersion=1.5
-XX:MaxPermSize=256m
-Xms2048m
-Xmx3072m
But when I am trying to see my total memory by
Runtime.getRuntime().totalMemory()
It is returning 62193664 that is 59mb. I also tried to launch eclipse from terminal setting vmagrs, but nothing changed. I don't know what is happening. How can I set the heap size? My total ram is 4gb and I using 64bit Ubuntu with 64bit eclipse. Any information will be very helpful to me.
1) The Runtime.getRuntime().totalMemory() does not return the maximum allowed heap size.
2) I'm not sure how do you run Runtime.getRuntime().totalMemory() but I guess you do that from within your Eclipse in a Java application. In this case you execute the call in another JVM which does not inherit properties from your eclipse.ini file. If you want to determine the initial and max heap size for it you can go to Run->Run Configurations.... Click on your current run configuration and in the right pane click on the Arguments tab. There you may specify the VM arguments, e.g.:
-Xms64m
-Xmx1024m
Afterwards you may continue experimenting with the Runtime. eclipse.ini configures the resources for the Eclipse IDE not for the Java application that you run.
Cheers!
In short, Runtime.getRuntime().totalMemory() is useless, it returns the size of one GC generation.
This thread has an explanation: http://mail.openjdk.java.net/pipermail/hotspot-gc-use/2008-December/000318.html
Thank you. So the solution is setting VM Arguments from Run->Run Configurations in eclipse. I had set it to -Xms3072m -Xmx3072m and now the Runtime totalMemory() is returning 3087007744 that is 2944MB in 4gb ram with 64 bit Ubuntu 10.10 and 64 bit JVM.

Eclipse - Java Heap error while in interface

I am pretty new to eclipse and it was working fine but now its giving me Java Heap problems and sometimes outofmemory issues...
Can anyone help me with my eclipse.ini ... i have increased some memory values and it got better but not perfect...
I am using this java but currently not doing java editing as such i am just in the eclipse interface ..
1.6 1.6.0_16 http://java.sun.com/products/autodl/j2se C:\Program Files\Java\jre6\bin\javaw.exe true
Here is my ini, its very small currently
-startup
plugins/org.eclipse.equinox.launcher_1.0.201.R35x_v20090715.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.0.200.v20090519
-product
org.eclipse.epp.package.rcp.product
--launcher.XXMaxPermSize
384M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
-nl en_US
-Dosgi.requiredJavaVersion=1.5
-Xms128m
-Xmx512m
-Djava.net.preferIPv4Stack=true
Heap issues have been seen before (see this question, or that one, for instance).
Various settings have been proposed (like here), since heap size can be specified in Java.
After quite a bit of experimenting with eclipse.ini, I found my version of it stable enough for most current usage.
See Eclipse Galileo 3.5 and 3.5.1 settings (as part of various other eclipse optimizations)

Categories