STS slow build when loading xyz-context.xml files - eclipse

i recently started using STS on a 64 bit Windows machine. Often when i "clean" my project STS gets unresponsive or just takes minutes to build while loading context.xml. files.
How can I fix this? Is it looking for resources on the web and waiting for timeouts.?
EDIT: I noticed that during the build process my network usage goes up. Not sure yet what is going on there...
EDIT: Possibly STS is loading all of the referenced springsource XSD files for XML validation?`If so, how can I disable this validation (apart from copying the files and referencing them locally, of course)? I've already tried disabling all of the Preferences related to "Validation" in STS - to no avail.

Often it is, because java is running out of free memory and need to run the garbage collector very often.
You can see the free memory in the bottom right corner of eclipse if you enable Window/Prefercences/General/"Show heap status".
If you can confirm that it is a memory problem, then you can increase the memory in sts.ini (-Xmx).
It is said that the 64bit java version needs up to 1/3 more memory than the 32bit version. But I don't know if this rumour is right or not.

Related

How to make GGTS / STS super fast?

I am using GGTS 3.2 JUNO 4.2.2 with Grails 2.2.1. It occurs to me that the environment is very slow after a while. What can I do to make it faster?
Is there a way to use the full potential of the underlying system?
What I did was (GGTS.ini):
-Xms768m
-Xmx768m
-XX:PermSize=1024m
-XX:MaxPermSize=1024m
-XX:+UseParallelGC
Working with Grails and GGTS demands a high amount of memory provided to GGTS. The reason why your IDE is getting slower by the time is because it has to do many "stop-the-world" Garbage Collections to get the memory it needs.
Especially you can see that on opening a GSP file the first time on your IDE ...then GGTS goes dark for a while.
And you can see that on the heap status at the right bottom of your IDE (enable it at your preferences). Every time the used memory is near to your provided 1GB your GGTS is stop working for two or more seconds. After that there is some free memory again.
1GB of memory for GGTS is ridiculous low - 2GB should be the minimum with Grails and Eclipse.
But that's not all. GGTS has a memory leak with Grails Tests and automatically building. You can try to remove the Unit and Integration tests from your projects build path. That is my trick to avoid slowdowns. But if I had to write Unit Tests I have to restart GGTS every once in a while. (And I have 8192m written in my ggts.ini.)
Eclipse Foundation has published solutions for this
http://wiki.eclipse.org/Platform_UI/Juno_Performance_Investigation
Putting this: -vm C:\devsw\java\jdk7_67\jre\bin\server\jvm.dll in my GGTS.ini (and restarting GGTS) has stopped the blue circle from spinning.

GWT compiler is running out of memory. How do I configure it within IntelliJ?

I'm running GWT from within IntelliJ. (Plain GWT, IntelliJ v9). I'm able to run my application via my "GWT development mode" configuration, but when I try to run it through my "local tomcat" configuration, I get a bunch of incomprehensible error messages referring to Oracle and all sorts of weird stuff that I don't use, followed by this error which is sorted to the bottom of all the others:
Error: Out of memory; to increase the amount of memory, use the -Xmx flag at startup (java -Xmx128M ...)
I'm guessing that this error is the root cause.
According to my understanding, there is a GWT compilation step which runs in a JVM separate to both IntelliJ and tomcat, and so I'm unsure where to set the -Xmx parameter.
My question is: where do I find this -Xmx parameter? (And: am I on the right track, taking this error message at face value, or is it a symptom of deeper problems?)
You can configure the heap in the GWT facet settings:
As CrazyCoder just said you can increase the amount of memory for gwt compiler in the GWT Facet settings. The GWT Compiler running out of memory on bigger apps is very common if you don`t increase the amount of memory. Most projects should be fine with 512m, but on large projects I already needed more memory.
So this is not some out of memory error caused by some bad design on your behalf.
In my application, I set it to 1024 but it gives me out of memory after 7-9 page refresh on dev mode. And after that I tried it to optimize by doing performance hack, I separated my *.gwt.xml for every gwt module for specific browsers by setting:
MySampleModule_FF.gwt.xml
<set-property name="user.agent" value="gecko1_8"/>
And I run my dev mode with this gwt.xml for Firefox. In addition to it also separated internationalization as well.
After that my out of memory issues considerably decreased.
32 bit JDK also sometimes causes Out Of Memory error. Try using 64 bit JDK.
To those who get the same error under Eclipse, try to restore cache files (if they were removed accidentally in WAR folder ), this way I solve the same problem under my Eclipse project.

Eclipse hangs while debugging

I searched lot about this topics but can't find a proper solution.
I am using eclipse 3.6 Helios version with operating system fedora15. In my application I am using GWT2.4 for front end development.
Now while I work with debug mode and want to debug at some point at the same time eclipse hangs for 3-4 mins.It resumes after and again start to debug process.
I am using this eclipse from last 3 years with windows but not faced this issue.In fedora I am using it from last 4 months and this problems stated to occur from last one month.
I am not getting what is the issues with eclipse.
Please help me out.
Thanks in advance.
Is this something that happens with different projects/code, or is it the same code that causes freezes? I've had issues where threads have started in the background and caused problems.
You say "(...) hangs for 3-4 mins.It resumes after and again start to debug process.", what do you mean? Does it continue to debug and move to the next line, or is there a crash and it restarts?
How long has it been since you changed workspace? I've found this, rather than the Eclipse installation, to be an issue over time. Create a new workspace folder, export all your projects and preferences and start fresh.
You are using GWT 2.4 and I think you might be working with UI.xml too... There is a tag in each ui.xml at the top like
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
Which means eclipse is going to get that xhtml.ent file each time and there is a issue in GWT eclipse plugin have a look to below link
http://code.google.com/p/google-web-toolkit/issues/detail?id=5265
There is one comment which says
For me, removing
SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent"
and saving the document,
solves the problem..
maybe it is needed for something, so better you copy that locally somewhere, and link that.
Try it out and let me know.
I had experienced the exact same problem on a less-powerful notebook I had to use.
Try one of the following
Download the latest Eclipse version (It needs, just as helios, a lot of RAM and CPU because it's based on a new "architekture", in contrast to, for instance, galileo)
Make sure you are using the latest JDK and JRE
Download Eclipse Galileo, which does require pretty less resources and goes still very very fine with most projects!
It sounds like you are experiencing the features of the latest Eclipse arch. In the latest versions of Eclipse I have noticed that the more plugins and add-ons you have installed, the slower the environment runs. There are a lot of similar posts regarding performance on the new platform
I have removed all but the plugins I am using and never install anything not needed into the Eclipse environment.
I "may" have experience this. Not sure. Suddenly started working again. I was getting a hang every time I would try to debug an app, in the part of the code (inside GWT) that creates a "table" element. Could be that there is something that just takes a while and you just have to "wait it out" the when it happens. Go get a cup of coffee, type thing. anyway I HAD stepped deep into the GWT code, plenty so I'm convinced it IS a GWT issue of some kind.
I was thinking it was some infinite recursion possibly in the logging system (like logger code accidentally trying to log itself, and going into loop?). Also there's a 50/50 chance that it was simply clicking on 'run' instead of 'debug' made it start working again. So at least try that if you have problems. My gut instinct and 30yrs programming under my belt tells me it's logger related. I can rule out "slow computers" because I never had this happen until I got a new machien which is Dell XPS, Core i7, 8 GB ram, and massive disk. So I wouldn't blame hardware, or Eclipse bloat.

How can you speed up Eclipse?

This question's answers are a community effort. Edit existing answers to improve this post. It is not currently accepting new answers or interactions.
How can you make the experience with Eclipse faster?
For instance: I disable all the plugins I don't need (Mylyn, Subclipse, …).
Instead of using a plugin for Mercurial, I configure TortoiseHG as an external tool.
The three most influential factors for Eclipse speed are:
Using the latest version of Eclipse (2020-06 as on 26 June 2020)
Note that David Balažic's comment (July 2014) contradicts that criteria which was working six years ago:
The "same" workspace in Indigo (3.7.2) SR2 loads in 4 seconds, in Kepler SR2 (4.3.2) in 7 seconds and in Luna (4.4.0) in 10 seconds. All are Java EE bundles. Newer versions have more bundled plugins, but still the trend is obvious. (by "same" workspace I mean: same (additionally installed) plugins used, same projects checked out from version control).
Launching it with the latest JDK (Java 14 at the time of writing, which does not prevent you to compile in your Eclipse project with any other JDK you want: 1.4.2, 1.5, 1.6 older...)
-vm jdk1.6.0_10\jre\bin\client\jvm.dll
Configuring the eclipse.ini (see this question for a complete eclipse.ini)
-Xms512m
-Xmx4096m
[...]
The Xmx argument is the amount of memory Eclipse will get (in simple terms). With -Xmx4g, it gets 4 GB of RAM, etc.
Note:
Referring to the jvm.dll has advantages:
Splash screen coming up sooner.
Eclipse.exe in the process list instead of java.exe.
Firewalls: Eclipse wants access to the Internet instead of Java.
Window management branding issues, especially on Windows and Mac.
Dec. 2020, Udo conforms in the comments
From version 4.8 (Photon) an up there was a steady speed gain after each version.
The main platform was optimized every release to load faster, enable more features for the dark theme and to add more features for newer Java versions for the Java development tools.
Especially with-in the last 3 versions the startup time was increased a lot. There should be a significant increase in start-up time with the newest version of Eclipse 2020-12.
In my experience it started a lot faster with each new version.
But: There are still plug-ins which do not follow the new way of using the Eclipse API and are therefore still slow to start.
Since the change to Java 11 as the minimum runtime version starting from Eclipse version 2020-09 at least the core system uses the newer features of the JVM. It is up to the providers of the other plug-ins to upgrade to newer APIs and to use the full power of modern CPUs (e.g. concurrent programming model).
See also
Giving Eclipse the right number of threads and the right amount of memory: Problem: Eclipse and the Eclipse indexer take up all my resources / CPU%
Add -Xverify:none to your eclipse.ini file.
It will cut down your Eclipse startup time considerably (50% in my case if not more). This will tell the VM not to validate all the .class files it is loading.
Consider this: Never Disable Bytecode Verification in a Production System
(as mentioned in the comments)
Go to Windows -> Preferences -> Validation and uncheck any validators you don't want or need.
For Eclipse 3.7, you use Windows -> Preferences -> General -> Startup and Shutdown.
Make sure that you're using the Sun JVM to run Eclipse.
On Linux, particularly Ubuntu, Eclipse is installed by default to use the open source GCJ, which has drastically poorer performance. Use update-alternatives --config java to switch to the Sun JVM to greatly improve UI snappiness in Eclipse.
Close any open projects which are not in current use.
Try to switch off the auto publish mode during development.
Thanks for the hints.
These options (mentioned above) helped me a lot:
Windows:
Increasing memory & regarding to my updated Java version in eclipse.ini:
-Dosgi.requiredJavaVersion=1.6
-Xms512m
-Xmx512m
-XX:PermSize=512m
-XX:MaxPermSize=512M
-Xverify:none
Additionally, since we are optimizing for speed, setting -Xms to the same value as -Xmx makes the JVM start with the maximum amount of memory it is allowed to use.
Linux / Ubuntu:
Using
update-alternatives --config java
Another performance boost can be gained by disabling label decorations
(Windows -> Preferences; General -> Appearance -> Label Decorations)
and by disabling unused capabilities on startup
(Windows -> Preferences; General -> Startup and Shutdown).
You may also get additional performance by choosing a different garbage collection strategy depending on your JVM.
If you're fed up with restart cycles you could use JavaRebel from ZeroTurnaround. That will shorten your time spent on server/client restarts.
While not directly related to Eclipse:
If you're running Windows 7 (and presumably Windows Vista), be sure to disable the file indexing of your workspace folder if your stuff is is in the default place - your home folder. Windows by default indexes everything in you home folder, and it's normally just a waste for your workspace. (Right click the workspace folder in explorer , Properties -> Advanced.)
Disable virus scanners, or at least configure any virus scanner to not scan JAR files on read access.
Eclipse loads plug-ins lazily, and most common plug-ins,
like Subclipse, don't do anything if you don't use them.
They don't slow Eclipse down at all during run time, and it
won't help you to disable them. In fact, Mylyn was shown to
reduce Eclipse's memory footprint when used correctly.
I run Eclipse with tons of plug-ins without any performance
penalty at all.
Try disabling compiler settings that you perhaps don't
need (e.g. the sub-options under "parameter is never read).
Which version of Eclipse are you using? Older versions
were known to be slow if you upgraded them over and over
again, because they got their plug-ins folder inflated
with duplicate plug-ins (with different versions). This
is not a problem in version 3.4.
Use working-sets. They work better than closing projects,
particularly if you need to switch between sets of
projects all the time.
It's not only the memory that you need to increase with the -Xmx
switch, it's also the perm gen size. I think that
problem was solved in Eclipse 3.4.
There is another thing that really speeds up Eclipse on both Windows and especially Linux - putting the JVM in RAM disk.
For Windows you can use the commercial RAM disk driver from Qsoft.
For Linux use any of the methods described in numerous articles on the Internet. It is important to give additional space to the RAM disk that is 10% bigger than the size of the JVM.
Check it out. It really makes a difference.
I give it a ton of memory (add a -Xmx switch to the command that starts it) and try to avoid quitting and restarting it- I find the worst delays are on startup, so giving it lots of RAM lets me keep going longer before it crashes out.
Along with the latest software (latest Eclipse and Java) and more RAM, you may need to
Remove the unwanted plugins (not all need Mylyn and J2EE version of Eclipse)
unwanted validators
disable spell check
close unused tabs in Java editor (yes it helps reducing Eclipse burden)
close unused projects
disable unwanted label declaration (SVN/CVS)
disable auto building
reference:making-eclipse-ide-faster
I implemented a plug-in to configure which features to be loaded in runtime to improve the performance and reduce the conflict among different plug-ins.
You may have installed many features into your Eclipse, such as Android development tools, C/C++ development tools, PHP, SVN, Git and ClearCase plug-ins. Hence Eclipse is heavy and costs a lot of memory, and some of them are not often used.
So you could use my tool to create different runtime policies, such as one that has Android, Git and base Eclipse, another one contains C/C++, SVN and base Eclipse. Next time Eclipse would only load the specified features if you're using the policy that only has Android and Git.
You are welcome to try it and give me the feedback. :)
The name of that tool is Equinox Advanced Configurator.
One more trick is to disable automatic builds.
I also tuned vmargs and stuff. But what really sped up Eclipse on Windows is the "proper" configuration of the anti-virus software. You have to disable the on-demand scanning of packed files. jar files, and many files related to java are packed with PKZIP algorithm to spare space. Because Eclipse uses tons of java files, an anti-virus attempts to individually unpack and scan every one of them. So for Windows platform: turn off the on-demand scanning of packed files, otherwise Eclipse will be unusably slow. Please keep in mind, that disabling this unfortunately makes your system weaker against attacks, most of the malware use packers.
I experienced a considerable improvement in performance when limiting the number of open tabs (in the past I frequently had 30+ tabs open). You can let Eclipse handle this for you automatically:
Window -> Preferences -> Editors -> close editors automatically
8 open tabs is the amount before the >> sign appears, so I tend to leave it at 8.
When opening more tabs, the ones the least recently accessed will be closed.
->When all editors are dirty or pinned
If it has unsaved modifications you can prompt to save & reuse (tab will be closed, a new one will be opened in its place). Or you can open a new editor end thus increase the amount of open tabs (the unobtrusive choice).
If you want to ensure some tabs never get closed autmatically, you can pin them. This by clicking on the pin icon (the rightmost icon in the toolbar, with "pin editor" as tooltiptext).
Best practices in this thread are implemented in the free Optimizer For Eclipse, from ZeroTurnaround.
What does it help with?
Insufficient memory allocation
Class verification overhead
Excessive indexes and history
Obsolete or slow JDK
Eclipse being out of date
Lengthy build and redeploy times
For more details, check out this article from RebelLabs.
Make an effort to configure your build path. Code completion uses a lot of memory if it has to go through your whole project folder.
Right click on your project and choose preferences.
Choose your build path setting and remove your project folder.
Then add only the folders where you have your source code and library code.
Not to be underrated is having a fast machine. 16-32 GB of RAM, SSD and a decent processor... and who0o0om there you go.
**Tips for making Eclipse IDE Faster**
Eclipse will run faster when working with small projects. But when you have to work with large project, you will get irritated with its speed. Even with a huge RAM you will not be happy with its
speed.Below steps will help eclipse to increase its speed
Remove unwanted activation of some of the plugins at start-up by going to windows–>preference–>General–>Startup and shutdown
also make sure you don’t use those plugins in any of your views
Disabling label decorations which is of less use for you, will also help you to gain some performance . Go to Windows–>Preference–>General–>Appearance–>Label -> Decorations
Close unwanted projects and use working set option to move from one group of project to another smoothly.
Configure eclipse.ini which will be available in the eclipse installed location.
Configuring eclipse.ini should be based on your RAM
-Xms256m
-Xmx512m
-XX:PermSize=512m
-XX:MaxPermSize=512M
Also have a look at http://wiki.eclipse.org/Eclipse.ini for more options
to configure eclipse.ini.
Do not keep lot of tabs opened in the editor. Better to have around 20 tabs . Regularly close the unused tabs. To open resource we can always use ctrl+shift+R and ctrl+shift+T (java resource) instead of opening lot of tabs
I experienced a considerable improvement in performance when limiting the number of open tabs (In the past I frequently had 30+ tabs open). You can let eclipse handle this for you automatically:
Window->Preferences->Editors-> close editors automatically
8 open tabs is the amount before the >> sign appears, so I set 14 as my default value.
When opening more tabs, the ones the least recently accessed will be closed. When all editors are dirty or pinned.
If it has unsaved modifications you can prompt to save & reuse (tab will be closed, a new one will be opened in its place). Or you can open a new editor end thus increase the amount of open tabs (the unobtrusive choice). If you want to ensure some tabs never get closed autmatically, you can pin them. This by clicking on the pin icon (the rightmost icon in the toolbar, with “pin editor” as tooltiptext).
Go to Windows -> Preferences -> Validation and uncheck any
validators
you don’t want or need.
Go to Windows -> Preferences -> General -> Appearance -> and uncheck any animation you don’t want or need.
Go to Windows -> Preferences -> Maven and check 'do not automatically update dependencies'.
I've disabled all unused options in Windows > Preferences > General and it has a huge positive impact on performance, eclipse is still slow when switching tabs, I don't want to increase memory, but it's a lot faster when scrolling. Thx for the tips.
Try this too, it will improve the performance:
cleaning up indexes - {workspace
path}.metadata.plugins\org.eclipse.jdt.core cleaning up history -
{workspace
path}.metadata.plugins\org.eclipse.core.resources.history
Cleaning the above folders will not impact the project files.
Well, if you are developing a GWT application using Eclipse, then this is the way:
Out of memory error in Eclipse
Also remember to add the same VM arguments to the hosted mode configuration.
If you use Maven and ivy do check out their consoles in case they are hogging processing during builds. I use ivy and on top of that I have certain JAR files (internal) changing with same version, so it has to workout all the time to fetch them.
If you have defined you project on a network drive then you will also experience lag during build/read/write type of processes.
Disable/uninstall plugins you don't need.
Close perpective that you don't need
Close unused database connections
In special cases, bad performance can be due to corrupt h2 or nwire databases. Read Five tips for speeding up Eclipse PDT and nWire for more information.
Where I work, we are dependent on a VM to run Debian. I have installed another Eclipse version on the VM for testing purpouses, but this sometimes creates conflicts if I have the other Eclipse version running. There is a shared folder which both of the Eclipse versions shares. I accidentally left the Debian Eclipse installation running in the background once and that gave me corrupt database files.
On Windows 8.
Open Control panel. Find Windows Defender. Go to settings
Exclude all folders where is your Spring/Eclipse and workspace
Apart from configuring eclipse.ini for memory usage. I have configured by "Start up & shutdown options". My Eclipse is blazing fast now.
The only real way to hasten Eclipse with the standard plug-ins is to give it more memory and in some cases access to a faster storage space / defragmented hard drive.
Beyond that there is not much you can do performance-wise: most standard plug-ins do not have a continuous runtime cost, even Mylyn is relatively fast.
Upgrading to the latest JVM supported on your machine may help as well.
Some people downgrade to older Eclipse versions to get better performance. It may also make sense to use Eclipse classic instead of the official releases.
Try these. There are two ways.
First Procedure
Refer this article.
http://www.javacodegeeks.com/2014/06/the-real-way-to-make-eclipse-run-faster-on-ubuntu.html
Second Procedure.
Execute the command in the terminal.
ramdisk
to get better performance and fast response for Ubuntu.
Ramdisk is part of system memory. Ubuntu by default uses a half of physical memory (RAM) as ramdisk, and it is mounted onto
/dev/shm
, it can be used just like normal disk space (create files and folders and manipulate them with better performance rather if they were stored on the hard disk). If ramdisk uses more than a half of RAM, data will be moved into the swap space. If ramdisk uses less, the remaining can still do what RAM’s doing.
Set upper limit of ramdisk
As is said above, ramdisk by default can use a half of RAM. If you want to change the upper limit, follow the steps below:
Edit /etc/fstab by your favourate editor:
gksudo gedit /etc/fstab
Find this line and change to make it looks like this(add this line if not exist, and change 512M to what you like.):
tmpfs /dev/shm tmpfs defaults,size=512M 0 0
Reboot or re-mount
/dev/shm
Mount /tmp onto ramdisk
To make it easy to use, you can mount a directory into
/dev/shm
by following commands:
mkdir /dev/shm/tmp
chmod 1777 /dev/shm/tmp
mount --bind /dev/shm/tmp /tmp

Is Eclipse 3.4 (Ganymede) memory usage significantly higher than 3.2?

I was happily using Eclipse 3.2 (or as happy as one can be using Eclipse) when for a forgotten reason I decided to upgrade to 3.4. I'm primarily using PyDev, Aptana, and Subclipse, very little Java development.
I've noticed 3.4 tends to really give my laptop a hernia compared to 3.2 (vista, core2duo, 2G). Is memory usage on 3.4 actually higher than on 3.2, and if so is there a way to reduce it?
EDIT: I tried disabling plugins (I didn't have much enabled anyway) and used the jvm monitor; the latter was interesting but I couldn't figure out how to use the info in any practical way. I'm still not able to reduce its memory footprint. I've also noticed every once in a while Eclipse just hangs for ~30 seconds, then magically comes back.
Yes memory usage can get real high and you might run into problems with your JVM, as the default setting is a bit to low.
Consider using this startup parameters when running eclipse:
-vmargs -XX:MaxPermSize=1024M -Xms256M -Xmx1024M
With those options, I manage to limit the memory used to 700Mo (which is quite high, but still workable with my 2 Go)
-vmargs
-Xms128m
-Xmx384m
-Xssv2m
-XX:PermSize=128m
-XX:MaxPermSize=128m
-XX:CompileThreshold=5
-XX:+UseParallelGC
-Dcom.sun.management.jmxremote
And consider also to launch
C:\[jdk1.6.0_0x path]\bin\jconsole.exe
And choose 'Connection / New connection / 'eclipse' to monitor the memory used by eclipse
(which is why I use '-Dcom.sun.management.jmxremote')
Other options are available here.
The more plugins you have, the more memory Eclipse will consume. 3.4 includes more plugins by default than 3.3, and so on, and so on, as more and more developers clamor for features to be included.
Go to Window->Show View, and start typing "plug in", and one of the options will be the Plug In Registry. Open that view, and click on the arrow to show active plugins only. These are the plugins actually loaded into memory. My Eclipse 3.3 currently has 89 out of 445 or so plugins loaded. You can then selectively start disabling plugins from the Help menu, once you see which ones you won't use (right now, for instance, I"m not using Mylyn, but I hope to in the future).
To add to my previous answer and to your recent update:
Eclipse just hangs for ~30 seconds, then magically comes back.
That is usually a sign for a failed network access with a timeout (and the associated 'freeze' while the application is waiting for said timeout).
try typing 'net use' in a DOS prompt, and check if you have net path declared there, some of them you could get rid off ('net use /D aUselessPath'). To be sure, check also the shares that you declare (net share).
Since you are with Vista, try also to deactivate superfetch and see if you still experience those freezes (both for eclipse and Firefox).
Open a CMD prompt with administrative privileges and enter "net stop superfetch" to stop the SuperFetch service.
It is not a good long-term solution though, just a quick check to make. Superfetch should be kept on, and will actually restart on your next reboot, since the service is set to start automatically at each Windows session.
Again, this is just to see if there is any connection between that service and your freezes.