After switching to Eclipse 4.2.0 the debugger seems to be not responable or very very slow. My used Java version is (same as used in Eclipse):
johannes#luna:~/sirix$ java -version
java version "1.7.0_03"
OpenJDK Runtime Environment (IcedTea7 2.1.1pre) (7~u3-2.1.1~pre1-1ubuntu3)
OpenJDK 64-Bit Server VM (build 22.0-b10, mixed mode)`
Anyone else encountered the same behavior?
Edit: I have had too many (old) breakpoints (maybe especially breakpoints on checked and unchecked exceptions are especially costly ;-))
I don't know about how to speed up the debugging in Eclipse, but there are some general rules you can follow to speed up Eclipse on a whole:
Disable antivirus software, or add your JDK & eclipse & workspace & other related folder to white list in your antivirus software.
Disable unnecessary validations and startup action in Eclipse reference.
For validations: on Eclipse menu Windows -> Preferences -> Validation, click “Disable All”, and then select the validator which you need. I selected “Classpath Dependency Validator” only.
For startup action: on eclipse menu Windows -> Preferences, type “startup”, select “Startup and Shutdown”, untick the options you don’t need. (Thanks for David’s suggest, I’ve added the above 2 detail steps for readers)
Modify eclipse.ini to set the Xmn(new generation size), Xms and Xmx, enable parallel GC
-vm C:/jdk1.6.0_25/bin
-startup plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar
–launcher.library plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.100.v20110502
-product org.eclipse.epp.package.jee.product
–launcher.defaultAction openFile
–launcher.XXMaxPermSize 256M
-showsplash org.eclipse.platform
–launcher.XXMaxPermSize 256m
–launcher.defaultAction openFile
-vmargs
-server
-Dosgi.requiredJavaVersion=1.5
-Xmn128m
-Xms1024m
-Xmx1024m
-Xss2m
-XX:PermSize=128m
-XX:MaxPermSize=128m
-XX:+UseParallelGC
Create a ram disk(virtual disk) on memory, and put your jdk on the ram disk.
You can use imdisk to create ram disk. Firstly download it from: http://www.ltr-data.se/opencode.html/#ImDisk, and install it.
Then set the ImDisk driver to auto-load at Command Prompt with administrative privileges (for example right-click, start as Administrator), type:
sc config imdisk start= auto
net start imdisk
Create a 200m ram disk as driver n by:
imdisk -a -t vm -s 300m -m n:
Then you should format the ram disk manually.
Later, if you would like to remove the ram disk, just run the command:
imdisk -D -m n:
Make sure you are using Sun JDK, not open JDK/GCJ nor other JDK on Linux.
If you are not satisfied with the after the above steps, install jRockit instead of Sun JDK, and change some of the VM options by jRocket specification,
jRockit is faster than Sun JDK.
Check that you don't have any method breakpoints. Those can be incredibly slow.
Make sure you clear all the expression in the Expression window when debugging. Add expressions only when u require and remove after use.
Related
So I installed STS a while back now onto my Windows 7 64-bit machine, every time I try run STS I get the attached Java exit code=13 error below.
I don't have have Eclipse installed into my machine, I mention this because every time I have tried to Google this error code threads about the same issue happening on Eclipse come up.
I have also tried checking if Java is installed on my machine which it is.
Does anyone know how to resolve this?
First you need to check that you are using 64 bit java.
Next you need to point to that version of java in your STS.ini file.
You can do this by specifying the -vm option in the STS.ini file. The -vm option must be placed after the other Eclipse-specific options (such as -product, --launcher.*, etc), but before the -vmargs option.
-vm argument might look like:
-vm
C:\jdk1.7.0_21\bin\javaw.exe
or
-vm C:\jdk1.7.0_21\bin\javaw.exe
or
-vm C:\jdk1.7.0_21\jre\bin\java.exe
If you encounter Java was started but returned exit code=1 point the `-vm option to jvm.dll
-vm
C:\Development\Java\64bit\jdk1.7.0_09\jre\bin\server\jvm.dll
Here is how I added it in my STS.ini file.
-startup
plugins/org.eclipse.equinox.launcher_1.3.100.v20150511-1540.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.300.v20150602-1417
-product
org.springsource.sts.ide
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
256M
-vm
C:\Program Files\IBM\Java71\jre\bin\java.exe
-vmargs
-Dosgi.requiredJavaVersion=1.7
-Xms40m
-XX:MaxPermSize=256m
-Xverify:none
-Dorg.eclipse.swt.browser.IEVersion=10001
-Xmx1200m
References:
Eclipse Wiki page
Stack overflow answer by DNA to similar question
I faced this issue due to my java update.
So below is the cause
Or java 64 bit and eclipse 32 bit version
You have java version 32 bit and eclipse 64 bit version
External cause, if you have two version of java installed(32 bit and 64 bit), if one got updated means your path variable pointing to
java will change.
Solution:-
Check your java version is 32 bit or 64 bit with command below
java -d64 -version
If It's 64 bit it will show
java version "1.8.0_181"
Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)
If It's not
It will show something like this
Error: This Java instance does not support a 64-bit JVM.
Please install the desired version.
Based on the java version change your STS, to either 32 bit or 64 bit.
Check that you are using correct java version for your OS architecture, 32 or 64 bits
STS mostly ends up with error code 13 if you are using for the first time. Here is a fix to the problem. Please visit this link I found here https://youtu.be/cMClVM6rzuc.
here is the summary of the solution
- The Error while launching STS is mostly because you have downloaded 32 bit STS bundle from spring.io website. you need to check your system architecture and download the appropriate version. You can watch the video for detailed information. I am 100% sure you will find your solution
If you dowloaded 64 bits version of STS Spring,
check the version of java you have by taping in cmd :
java -d64 -version
If you dont have the jre 64 bits, install it and it will work .
I removed C:\ProgramData\Oracle\Java\javapath from the PATH environment variable. It worked for me then. So basically it's a path variable issue.
please make sure you download the 64bit version from https://spring.io/tools/sts/all.
On the STS page, the Download STS button downloads the version for 32-bit Windows by default. Under the download button, click See all versions (https://spring.io/tools/sts/all). From there you can click the menu button and select the 64-bit Windows version.
Just install 32-bit JRE (if you have 64 bit already installed) and point -vm to this 32-bit JRE as mentioned above.
So basically when you go to Spring website, it doesnt understand your client OS and prompts you to download 32 bit version. I faced the same issue and explicitly had to download 64 bit version, by clicking on "see all versions". Also some suggested removing "C:\ProgramData\Oracle\Java\javapath" entry from Path, but while it is true if you have actually downloaded JDK 1.8, it is not going to help resolve the specific issue here.
Open "SpringToolSuite4.ini" or sts.ini and make sure you have javaw.exe path in .ini file.
-vm
D:\Projects\Softwares\JDK\bin\javaw.exe
File should look similar as below.
-startup
plugins/org.eclipse.equinox.launcher_1.5.400.v20190515-0925.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.1000.v20190125-2016
-product
org.springframework.boot.ide.branding.sts4
--launcher.defaultAction
openFile
-vm
D:\Projects\Softwares\JDK\bin\javaw.exe
-vmargs
-Dosgi.requiredJavaVersion=1.8
-Xms256m
-Xmx1024m
-XX:+UseG1GC
-XX:+UseStringDeduplication
--add-modules=ALL-SYSTEM
You likely installed the default version of STS from the spring.io website which is normally the 32 bit version.
Click to see all versions and download the windows 64 bit version from the next page.
Good luck.
By Removing following java path from environment variables path is fixed the issue.
C:\Program Files (x86)\Common Files\Oracle\Java\javapath
Have another jdk in path.
Initial I uninstall another Java SE Development Kit , next I added the follow path in the *SpringToolSuite4.ini in my case:
*(depends of your IDE that you´ve installed)
-vm
C:\Program Files\Java\jdk1.8.0_131\bin\java.exe**
You just need to reinstall JDK(same or latest version) and STS(not always required).
First of all, please check your STS path. Remove if there is any special character such as # or etc in your path. After verify this, please go for any of the above solutions ;)
The first step is like the is already related above: open the document parameters of configuration "STS" and send the commands below to "openFile":
-vm
C:\Program Files\Java\jdk-11.0.2\bin\javaw.exe
To check the version of JDK, on your prompt do the command:
java -version
You will find in "build".
If you still having the problem with JDK path not finded, the path to found your JDK on pc is:
my computer -> archives and programs -> java -> jdk -> bin -> javaw
when you reach at this, click and inspect the properties of and copy the route to put on command after -vm.
When I run my Java code in Eclipse, I get the following message:
There is insufficient memory for the Java Runtime Environment to continue.
Native memory allocation (malloc) failed to allocate 4088 bytes for AllocateHeap
An error report file with more information is saved as:
E:\Eclipse_Workspace\BTest\hs_err_pid1888.log
I have 4GB RAM in my computer. I have changed my JRE from 1.7 to 1.8 too. But the issue seems un-resolved. I use a Win 8 system with i3 Processor and have around 20gb of free disk space in my C Drive.
Eclipse version: Eclipse Juno Service release 2
I also get this message while starting Eclipse. I have attached the error message screen shot.
What is causing this issue?
Memory parameters in "eclipse.ini" file:
-startup
plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.200.v20120913-144807
-product
org.eclipse.epp.package.java.product
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
256M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Dhelp.lucene.tokenizer=standard
-Xms40m
-Xmx512m
Resolution:
Re-installing eclipse fixed the problem.
The message above means that you're running so many programs on your PC that there is no memory left to run one more. This isn't a Java problem and no Java option is going to change this.
Use the Task Manager of Windows to see how much of your 4GB RAM is actually free. My guess is that somewhere, you have a program that eats all the memory. Find it and kill it.
EDIT You need to understand that there are two types of "out of memory" errors.
The first one is the OutOfMemoryException which you get when Java code is running and the Java heap is not large enough. This means Java code asks the Java runtime for memory. You can fix those with -Xmx...
The other error is when the Java runtime runs out of memory. This isn't related to the Java heap at all. This is an error when Java asks the OS for more memory and the OS says: "Sorry, I don't have any."
To fix the latter, close applications or reboot (to clean up memory fragmentation).
How to diagnose this error even when running the simple command:
java -version
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Cannot create GC thread. Out of system resources.
# An error report file with more information is saved as:
# /home2/ericlesc/code/java/c2/hs_err_pid23944.log
Check the amount of free memory you have:
free -m
total used free shared buffers cached
Mem: 28119 26643 1475 189 2391 15368
-/+ buffers/cache: 8884 19235
Swap: 5117 34 5083
Check the max number of user processes, make sure you are not over limit:
ulimit -a
ps -ef | wc -l
For me, the reason this happened was because PHP had consumed too much memory allocated to me on bluehost, and the way I was able to fix it, without restarting PHP or the server ( I can't ) was to take the public_html directory and rename it. And give it a minute for PHP to see the change, then rename it back.
A bug in the php engine itself. I found a clever way to give the PHP engine a swift kick.
(update Feb 2016) (I'm getting a spike of up-votes on this because Bluehost instance PHP engines are reserving all the memory and leaving none for the JVM. In their defense, PHP is evolving into an unholy rube Goldberg machine. Bluehost as a service is on the decline.
If you are on ec2 and wanted to do mvn build then use -T option which tells maven to use number of threads while doing build
eg:mvn -T 10 clean package
If you are using Virtual Machine (VM), allocate more RAM to your VM and your problem will be solved.
In your Eclipse installation directory you should be able to find the file eclipse.ini. Open it and find the -vmargs section. Adjust the value of:
-Xmx1024m
In this example it is set to 1GB.
Try to modify your eclipse.ini with below
-startup
plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.200.v20120913-144807
-product
org.eclipse.epp.package.jee.product
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
512M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
512m
--launcher.defaultAction
openFile
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Dhelp.lucene.tokenizer=standard
-Xms2G
-Xmx3G
-XX:MaxPermSize=2G
-XX:+UseCompressedOops
-XX:+UseParallelGC
Once you open your eclipse you can try below
Looks like your application consumes more memory than allocated (Default). I will try two things
As suggested by Harmlezz increase your memory allocation to JVM to -Xms2g -Xmx2g (If needed increase it more and try it out)
Download eclipse memory analyzer and check for what causing memory leak OR even you can use JConsole to see JVM memory utilization in order to figure out application memory leak issue.
It is quite simple to fix, I am not sure why no one mentioned the actual working solution.
Firstly, make sure, Wireless Hotspot is Turned Off. That's most important, while building the Project, the Hotspot must not be On.
Do this, and Thanks me later 💖
Secondly, set the Environment Variables into your system, and Thirdly disable the firewall or antivirus for Android Studio & Java VM. It will definately fix your issue.
Starting Gradle Daemon...
Gradle Daemon started in 4 s 291 ms
Starting Gradle Daemon...
Gradle Daemon started in 5 s 664 ms
Starting Gradle Daemon...
Gradle Daemon started in 2 s 210 ms
Starting Gradle Daemon...
Gradle Daemon started in 7 s 258 ms
In my case it was that I manually set the Windows virtual memory too low to save space in the system SSD.
You need to diagnosis the jvm usages like how many process is running and what about heap allocation. there exists a lot of ways to do that for example
you can use java jcmd to check number of object, size of memory (for linux you can use for example "/usr/jdk1.8.0_25/bin/jcmd 19628 GC.class_histogram > /tmp/19628_ClassHistogram_1.txt", here 19628 is the running application process id). You can easily check if any strong reference exists in your code or else.
I know the question talking about eclipse but i got the similar issue many times with Intellij as well and the solution for it was easy .. Just run the 64 bit exe not the 32 one which is always the default one.
In my case it was that the C: drive was out of space. Ensure that you have enough space available.
I am getting below error while starting eclipse
An internal error occurred during: "Updating indexes".Java heap space?
It was running fine half an hour before.I restarted the eclipse and getting this error now? i have 8 gb ram,window 7 64 bit OS.
i have tried restarting my system but nothing helped?
-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
-showsplash
org.eclipse.platform
-showLocation
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-product
org.eclipse.epp.package.jee.product
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
256M
-vm
C:/Program Files (x86)/Java/jdk1.6.0_25/bin/javaw.exe
-vmargs
-Dfile.encoding=UTF-8
-Dosgi.requiredJavaVersion=1.5
-Xms512m
-Xmx1024m
Not sure what i is the issue?
If you have m2e or other Maven plugin installed, you should check if the option at 'Window -> Preferences -> Maven -> Download repository updates index on startup' is enabled. Disable it and see if it resolves out of memory issue.
If you are using eclipse or myeclipse, you can increase memory by making changes in .ini file (myeclipse.ini)
-Xmx2048m
-XX:MaxPermSize=1024m
-XX:ReservedCodeCacheSize=512m
-Dosgi.nls.warnings=ignore
It will solve problem connected with heap space.
Assuming this is a heap space problem, try this FAQ:
Eclipse-Wiki: FAQ How do I increase the heap size available to Eclipse?
This may not be directly related to the question, but this fixed the java heap issues I had:
Launch eclipse using eclipse -vmargs -Xmx2048m.
From the readme included with the eclipse install:
By default, Eclipse will allocate up to 512 megabytes of Java heap
memory. This should be ample for all typical development tasks.
However, depending on the JRE that you are running, the number of
additional plug-ins you are using, and the number of files you will be
working with, you could conceivably have to increase this amount.
Eclipse allows you to pass arguments directly to the Java VM using the
-vmargs command line argument, which must follow all other Eclipse specific arguments. Thus, to increase the available heap memory, you
would typically use:
eclipse -vmargs -Xmx<memory size>
with the value set to greater than "512M" (512 megabytes
-- the default).
Old question, but I got this issue and adding more memory did not solve, so I rebuilt the java index by applying this comment from eclipse bug tracker:
I Quote:
Click in "Quick Access", Type "Rebuild Java Index" (Actually just start typing it, use the auto completion), Hit enter.
This is frustrating. I'm trying to run a program which loads into memory a 4000x3000 image. It runs fine in Ubuntu but not in Mac, throwing an OutOfMemoryError: Java heap space. Here's my eclipse.ini in Ubuntu
-startup
plugins/org.eclipse.equinox.launcher_1.0.201.R35x_v20090715.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.gtk.linux.x86_1.0.200.v20090520
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
-vmargs
-Xms128m
-Xmx512m
-Dorg.eclipse.equinox.p2.reconciler.dropins.directory=/usr/share/eclipse/dropins
As for Mac
-startup
../../../plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar
--launcher.library
../../../plugins/org.eclipse.equinox.launcher.cocoa.macosx_1.1.100.v20110502
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-vm
/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/bin/java
-vmargs
-Xms128m
-Xmx512m
-Xdock:icon=../Resources/Eclipse.icns
-XstartOnFirstThread
-Dorg.eclipse.swt.internal.carbon.smallFonts
Note that I've tried increasing the PermSize memory Xmx and Xmx of Mac to around 1024m but Mac still throws OutOfMemoryErrors. I only tried making them similar because, well, it runs in Ubuntu just fine.
Any suggestions?
Thanks!
These are your settings for eclipse, not for your program (I'm assuming you're not building it as an Eclipse component). Your program will run with the default settings unless you specify differently in your Run configuration.
The defaults java starts with depend on multile factors, like architecture, OS, and available RAM. So it's entirely possible that it would start with a lower memory limit on your mac.
To fix this, set Xmx to be the same on both systems (Also make sure they're on the same architecture, 64 bit apps might require more memory to do the same thing).
First, your error is about heap space, so changing Perm space isn't going to affect it.
Second, as Joeri pointed out, the eclipse.ini file affects how Eclipse itself runs, not programs that you write and run from inside Eclipse.
On your Launch Configuration, go to the Arguments tab and enter the -Xmx argument in the box labeled VM Arguments.
If you know for certain that you always want all your Launch Configurations to run with certain heap space arguments, you can assign them to the JRE. Open Eclipse Preferences and find Java > Installed JREs. From there, select the JRE that you want to work with, click the Edit button, and there you'll find a Default Vm Arguments field. If you set -Xmx there (or any other JVM arguments), they will affect any Launch Configuration that uses that JRE.
Increase the value of -Xmx parameter
I'm currently developing a tool allowing me to get statistics from anyware simply by going on a website I also created.
For those who don't know, Birt is a reporting tool, and an eclipse plugin.
My problem is the following :
I installed tomcat on the server hosting my website, and installed the Birt ReportEngine on it, and on my website, I call the online viewer to get my reports.
The problem is that since yesterday, when I launch a report, I have this error :
javax.servlet.ServletException: L'exécution de la servlet a lancé une exception
org.eclipse.birt.report.filter.ViewerFilter.doFilter(ViewerFilter.java:68)
Caused by :
java.lang.OutOfMemoryError: PermGen space
I don't really know which config file to modify to avoid this error. I found some examples online that tell to modify the eclipse.ini file, but as for mty website, I don't use eclipse, I didn't found any usefull post.
Can someone help me please ?
Thanks
As said by Thomas, the parameter to set is -XX:MaxPermSize. One way of setting this parameter for Tomcat is to use the CATALINA_OPTS environment variable.
For Windows :
set CATALINA_OPTS=-Xms512m -Xmx512m -XX:MaxPermSize=256m
For Linux (bash) :
export CATALINA_OPTS="-Xms512m -Xmx512m -XX:MaxPermSize=256m"
Check the startup.bat and catalina.bat or startup.sh and catalina.sh files in your tomcat/bin directory and add the above commands there.
(The Xmx and Xms parameters set the minimum and maximum size for the Java heap - where objects are stored. This is not the problem you have but I included them for the sake of completeness.)
You need no add the following line to eclipse.ini
-XX:MaxPermSize=128m
If the problem occurs again try to increase the value. You can also add the following optional lines:
-XX:+UseConcMarkSweepGC
-XX:+CMSClassUnloadingEnabled
-XX:+CMSPermGenSweepingEnabled
-XX:+UseParNewGC
This changes the Garbage Collector of the JVM to a more optimized one, and can also improve the performance and memory usage.
You may also want to tweak the values of the -Xmx and Xms options. Try small increases (same to the -XX:MaxPermSize) as this will increase the memory footprint of your JVM.
For a more explained details see here:
http://www.eclipsezone.com/eclipse/forums/t61618.html
For a complete list of the JVM parameters and options:
http://www.oracle.com/technetwork/java/javase/tech/vmoptions-jsp-140102.html
Use that JVM option: -XX:MaxPermSize=256m (of course you are free to choose the amount of memory, but IIRC the default would be 64m so you'd need to increase that). - Note that this is for Oracle's JVM (formerly SUN's :) ) , other JVM's might have different options.
Other than that, try not hot deploying too much, since that might also increase the PermGen space usage (JBoss which includes Tomcat as has that problem, but I'm not sure whether that is true for a standalone Tomcat).
This can be solved by allocating more heap memory.
this can be done as:
steps:
double click on your eclipse server->open launch configuration->Arguments->paste this line in vm arguments text area:-
-XX:MaxPermSize=512M -Xmx1024M
This will solve your outofmemory error.
I added the below line line to eclipse.ini and working fine for me.
-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.jee.product
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
256m
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms40m
-Xmx512m
-XX:MaxPermSize=256m