I'm developing a web application using java + gwt and NetBeans 6.9.1 + Glassfish 3.0.1. After some hours of development my system performances degrade, so I always check on Activity Monitor if some process is getting all memory or cpu. I always notice a couple of process named 'java' which spawns about 50-60 threads. My system is really slow until I kill them, then I can work again normally.
I use NetBeans debug mode during development, but even when I stop the debug mode, the java process keeps degrading system performances until I kill it. I also experience sometimes the "java.lang.OutOfMemoryError: Java heap space" error, it happens after several hours (let's say 12-16) my NetBeans istance is opened (this happens to me with the same NetBenas version also in a Linux environment). In this case, I need to close and reopen it to make it compile/work again.
Anyone experienced the same issues and/or knows how to avoid them? Do you think this problem could be caused by some sort of problem in the app I'm developing or could it be a Netbeans memory leak or bug?
We have similar issues with eclipse. We have tried out with lot of patience the following steps and resolved some of the issues.
Coding practices
1) Verified db/hibernate related session open and close on server side code and cleaned up hundreds of instances of bad practice of not-closed sessions ( this improves even deployment performance )
2) Verified io related bad practices and clean them up ( this improves even deployment performance )
Lighweight IDE
1) Ensure the IDE has only the plugins you need. Its okay to have multiple installation of IDE customized for task.
Example -
a) GWT Dev - One IDE instance has only GWT dev required plugins only
b) Code Refactoring - One IDE instance has findbugs, PMD, CodePro installed
Note: Always start off with minimal set up of IDE ( with and without hello world project code ). Profile and check whether some plugins leak memory when instantiated or when in regular use.
And as utsun said - You are lucky the out of memory shit happens a lot more often for some of us stuck on primitive hardware.
I would love to have others sharing some tips to gather or look for memory optimization of IDE apart from throwing more hardware. Example - a eclipse or netbeans build with only the absolutely essential plugins for gwt/maven/svn. Throw all other gimmicky stuff out.