Eclipse memory restricting - eclipse

I am using a 32bit WinXP with no upgrade in sight, is there a way to limit how much memory Eclipse allocates throughout the day? I am also running Weblogic 10 server in debug mode inside eclipse. After a few hours I have an 700mb STS.exe (eclipse) and 400mb java.exe (server). Is there at least a way to force a GC on eclipse?
Here are the settings i surrently use, which seem to me are not being observed.
-vm
C:\bea\jdk160_05\bin\javaw.exe
-showsplash
--launcher.XXMaxPermSize
128M
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms40m -Xmx512m
-Dsun.lang.ClassLoader.allowArraySyntax=true
EDIT: here's the monster of a project: Eclipse and Firefox 4.

is there a way to limit how much memory Eclipse allocates throughout the day?
The values of -Xmx and -XX:MaxPermSize place an upper bound on the memory that the JVM will use.
Is there at least a way to force a GC on eclipse?
AFAIK, no. Even if there was, it probably wouldn't help. The JVM is unlikely to give the memory back to the operating system.
Here are the settings i currently use, which seem to me are not being observed.
Based on what you've said (memory usage 700Mb for eclipse.exe), I'd say the settings ARE being observed.
What can you do to get Eclipse to use less memory?
Trim the values of -Xmx and -XX:MaxPermSize. However, if you do this too much you are liable to make Eclipse sluggish ('cos it has to GC more frequently) and ultimately flakey ('cos it will run out of memory and things will start failing with OOMEs)
Get rid of superfluous plugins.
Switch to a "smaller" Eclipse (e.g. the "Classic" distro) ... though you'll lose some of the J2EE support that you are probably using.
Close projects.
Close files.
Restart Eclipse more often.
But the best solution is to upgrade your platform:
Buy some more memory for your PC / laptop. You can probably max it out for a couple of hundred dollars. It is worth it.
Switch the OS to Linux. In my experience, Linux is a much better platform for doing Java software development than Windows XP. It seems to do a much better job in terms of both memory and file system management. The performance difference on identical hardware is significant.
You can always set up your machine to dual boot, so that you can still run XP for other things.

The 700MB of OS level process usuage is consistent with your memory settings. Take 512m for heap + 128m for permgen space + a bit of overhead for the JVM itself.
You cannot force GC. If memory was releasable, JVM would release it. Note that you cannot simply look at OS level process usage as that represents the point where the JVM memory usage peaked. JVM never releases heap or permgen space once it expands to a certain size. It is simply too expensive and not really necessary. The allocated space is in virtual address space of the JVM process. It doesn't represent actual physical memory usage. As physical memory gets tight, the OS will agressively swap out to disk memory pages that haven't been used recently.
So... You need specialized memory analysis tools to get accurate representation of Eclipse memory usage.
If you are seeing a lot of disk activity when there shouldn't be any, the OS may be indeed out of physical memory and doing a lot of swapping. Try closing a few projects or restarting Eclipse. It only takes one plugin with a memory leak to consume all of your available memory.

I'm assuming that you are running BEA JRockit judging by the path to javaw.exe. Note that the -X... options are JVM-specific, so they may not work the same way for JRockit as in Sun's JVM. This link seems to indicate that you should be using
... -Xms:40m -Xmx:512m ...
But setting a heap size limit will only cause Eclipse to fail once it reaches the limit, so you won't solve the real problem. Forcing a GC usually doesn't help; any sane VM will GC periodically or when needed.
Having a 700Mb Eclipse sounds like your Eclipse is either processing large amounts of data, or it is leaking memory. JRockit seems to have a memory leak detector which may be able to give you a hint of where the problem lies.

The ini file memory settings won't help for the Virtual machine. Change VM arguments, as here

Eclipse is very thirsty. Limiting it is most likely to crash it. You really need a new computer.

Related

Eclipse always exit when used in a virtual machine

I use ubuntu16.04 in VMware for learning Hadoop. The eclipse is Eclipse IDE for Java Developers at 2020.03 for linux_64.
And when use eclipse to write some java code, the IDE usually exits by itself without any error. And the eclipse is too slow when I use it. I guess that whether the memory is not enough for using IDE. But I found the memory is free when I check it. I allocated 2G of memory for ubuntu16.04.
And I search for this problem on web. I found many people believe the problem is eclipse caused. So they come up with a way to edit eclipse.ini.
-Dorg.eclipse.swt.browser.DefaultType=mozilla
Add this command to the last line of eclipse.ini.
Unfortunately, it doesn't work. So Do u know why? Should I allocate more memory for VMware?

How to increase memory for embedded jvm for a deployed javafx application?

I am using a .fxbuild-script to build a JavaFX Application. I used Packaging-Format all to include its own runtime. Now I am wondering, how I can define any runtime parameters?
Since we noticed, that we had far more OutOfMemory Issuses within the deployed version than with the local development version, we were monitioring it with Visual VM and noticed, that the embedded JVM (by default?) is only configured to use 256MB of RAM. How can I increase the Maximum available RAM for the included JVM?
The Application is launched by an .exe file after beeing installed on the system.
Update:
The Answer of Roland is correct. I just made the mistake, that I added the <fx:platform>-Tag at the Bottom of the Ant script and not within the appropriate <fx:deploy>-Tag which results in that the <fx:platform>-Tag will be ignored and the JVM is configured to use 256 MB max RAM on 32-Bit and 1/4th of available RAM on 64-Bit.
Please read the Packaging Basics, especially chapter "5.8.2 Customizing JVM Setup".
Excerpt of what you need:
<fx:platform javafx="2.1+">
<fx:jvmarg value="-Xmx400m"/>
...
</fx:platform>

Eclipse debugger stops working randomly

I have been working on a project that requires rigorous debugging at each step and I notice that my debugger just randomly stops working from time to time and does not respond to any of the breakpoints.
I tried restarting eclipse and unplugging my device over and over. Any particular reason this might be happening? Its extremely frustrating and I couldn't think of a better place to post this query.
Many a thanks in advance!
I know this is an old question. But I had that eclipse suddenly stopped working, i.e. died before even executing one line. I restarted VM and eclipse multiple time. Then I stumbled here. Thank you, it got my mind thinking.
For all major issues with eclipse, not loading, freezing or debugger fuck up (that is not because of your code :D ). Try the following line:
./eclipse -clean -clearPersistedState -refresh
First I would make sure your eclipse is not running out of heap space memory. If necessary increase the heap memory using the -mx Java command line flag. Running out of memory can cause various instability problems such as the one you describe.
-xms is the start memory (at the VM start), -xmx is the maximum memory for the VM
eclipse.ini : the memory for the VM running eclipse
jre setting : the memory for java programs run from eclipse
catalina.sh : the memory for your tomcat server

NetBeans 6.9 and javaw.exe uses > 50% of CPU

When i work with NetBeans 6.9 for PHP the javaw.exe is occupying more then 50% of CPU and about 450mb ram (ram is not really the problem) but CPU tend to overheat.
I had jdk6.5 for 64bit sys and now updated to latest jdk6.21 but it is the same, the CPU is always near 100%
is there a solution to this high requirements of javaw.exe?
OS: Win7 64bit
UPDATE:
I installed the NetBeans 6.7.1 the one that worked EXCELLENT to compare with 6.9.
so:
6.7.1 less memory usage by javaw.exe then 6.9 but cpu still in use > 50% nonstop
then:
I installed the JDK6_21 32bit cause i had 64bit and in the config (netbeans.conf) file set the path of the 32bit JDK.
6.9 less memory CPU still to high
6.7.1 less memory NO CPU usage when idle
SO im gonna downgrade to the 6.7.1 because it works for me and i dont really need the 6.9 cause i dont really use the new features that offers.
btw. 6.8 was crashing with no reason, so that option is out.
You could configure Netbeans to run java.exe instead of javaw.exe, and see if the behavior is still the same.
If it's the same, this is clearly a Netbeans problem, so I would suggest reporting this problem to Netbeans, since this is the way bugs get usually fixed :).
One thing you should consider doing on Netbeans (and Eclipse... and $insertOtherIDE) is to turn off automatic project indexing, compile on save, and other things that cause lots of work to happen in the background without your prompting.
In Netbeans 6.9, external scanning/indexing tends to be the biggest culprit when dealing with projects of considerable size. Try disabling it by (and these instructions are for the Mac, I assume they are similar on Windows)
Go to Preferences
Click on Miscellaneous
Click on the Files Tab
Deselect "Enable auto-scanning of sources"
After this you can force NB to re-scan by clicking Source->Scan For External Changes in the menu (might be Mac specific, again).
See if that helps you out at all...
I had the same problem (Win7 64bit). Everything was working, but suddenly (I think after refactoring some stuff) javaw.exe was constantly using the cpu.
After clearing the netbeans cache, everything was working again (delete the contents of the cache folder and restart Netbeans).
%UserProfile%\.netbeans\6.9\var\cache\
I had to do this before after getting strange errors in Netbeans and most of the time it solved the problems. I think sometimes it just gets out of sync.

How to reduce Eclipse's memory usage?

The memory usage of Eclipse 3.4 is through the roof to the point where it's becoming an issue.
I have a simple BlackBerry project loaded and the usage skyrockets to nearly 400 MB, sometimes higher. Is there something that can be done to bring it down?
Eclipse 3.4 can consume a lot more memory than the previous versions, courtesy the spellchecker plug-in.
You can switch off the plug-in by going to Window -> Preferences -> General -> Editors -> Text Editors -> Spelling, and unchecking the box title 'Enable spell checking'.
Of course, the tips offered to use larger heap sizes and better garbage collectors would do you good as well.
Checking General -> Show heap status will enable this
in the bottom bar.
This way you can manually run the garbage collector whenever you want by clicking on the trash can. It's not a fix, more like a workaround, but it helped reduce massively my RAM / CPU usage.
Remove +UseG1GC option from eclipse.ini. I've read from here that It is only used for araound 6GB heap memory.
In Eclipse Luna 4.4.1
Was trying to cut my memory usage in Eclipse. I managed to shave mine from 600mb to 300mb. I did the following:
Turned off the plugins activated on startup that I wasn't using. Windows > Preferences > General > Startup and Shutdown
Closed projects I wasn't working on at the time.
Found the hints/tips here : http://blog.elijaa.org/2010/09/20/tricks-to-speed-up-eclipse-php-helios-pdt-2-2/
Modern versions of Eclipse do need quite a bit of RAM to do their thing. But should still run pretty fast on any modern machine.
Assuming you have enough physical memory (2GB is fine unless you have lots of other processes running, or you're using RAD), see this article on Eclipse's memory usage for some tips on tweaking the settings. The two most common culprits are Xmx and/or MaxPermSize being set too low (Xmx defaults to 256M and MaxPermSize defaults to 64M).
You modify the values by passing command line arguments or tweaking the eclipse.ini in the Eclipse install location.
You should end up with something like this:
...
-vmargs
-Xms128m
-Xmx1024m
-XX:MaxPermSize=128m
While you probably could tinker with the configuration, removing various plugins etc, it's likely to be more cost effective to buy more memory. How much do you currently have? I would consider a developer machine with less than 2GB of memory to be under spec, and I suspect many people would double that...
My Eclipse is taking over 800MB resident, and 2GB virtual (part of it swapped out perhaps).
Java can be a hog, it's giving Java bad press all the time.
However, there is a little something that many people don't know: the incremental garbage collector. -Xincgc
The side effect is that it hands memory back to the system from time to time.
By default Java just takes and takes, and when it doesn't need memory anymore, it keeps it for itself.
The incgc is a different strategy where it becomes more reasonable to assume that memory can be handed back the system without running into trouble.
This can however affect performance.
There are many garbage collection settings. You can also have multiple threads handle GC. The parallel GC does that. Not sure if that one hands memory back, don't think so.
If 400 Mb of RAM is a big issue for you, you might want to try another IDE. Eclipse stores a lot of state information, some or most of which you don't actually need. That's a design choice.
Right now, I have the same project open in both Eclipse and QtCreator: after a clean rebuild, Eclipse uses 156 Mb RAM, Qt Creator is happy with 66 Mb.
You can try the 64bit version of Eclipse with the 64bit version of JDK on Windows 7. Those both caused some odd issues with the 3rd party Framework I have to work with. The 32-bit of JRockit (free now) from Oracle seems to be faster and be a little better on memory. This is my Eclipse.ini settings:
This is my eclipse inn
-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
-nosplash
org.eclipse.platform
--launcher.XXPermSize
512m
--launcher.XXMaxPermSize
512m
--launcher.defaultAction
openFile
-vm
C:/Program Files (x86)/Java/jrockit-jdk1.6.0_31-R28.2.3-4.1.0/jre/bin
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-vmargs
-Xquickstart
-XX:+AggressiveHeap
-XX:+AggressiveOpts
-XX:+UseParallelOldGC
-XX:ParallelGCThreads=2
-XX:ThreadPriorityPolicy=1
-Xverify:none
-Xms1100m
-Xmx1100m
I switched to the 32 bit JRockit JDK which seems a little faster for Eclipse. I turn off and don't install more than I need. For each separate type of app development (Android, J2EE, just Spring, ...) I have different Eclipse installations. Hard drive space is cheap. Then I can have just the plugins I need for each one. I would never want all the Android tools loading if I wasn't using them. STS is also good for just the Spring stuff and I have one just for OpenShift Cloud work.
Try disabling your eclipse plugins. Eclipse was hogging half of my of my memory when I had the saros plugin open.