7

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?

John Yeary
  • 1,112
  • 22
  • 45
Lorenzo Marcon
  • 8,029
  • 5
  • 38
  • 63
  • The first thing to do: Find out, which java application (NetBeans, GlassFish, ...) is executed by the majority of these processes. You can use `ps ax|grep java|sed G` in a Terminal to find out about the command line (look especially at the last argument of each line). – Chris Lercher Apr 02 '11 at 10:55
  • It looks like the father process is NetBeans. By the way, GlassFish is started by NetBeans itself, so I can't tell for sure.. I'm going to try to start GlassFish manually before launching NetBeans. – Lorenzo Marcon Apr 02 '11 at 11:12
  • Ok, starting glassfish manually I instantly get a java process with 50+ threads, even with NetBeans closed. ATM the system isn't slow, but performaces still degrade after several hours of development with Netbeans. – Lorenzo Marcon Apr 02 '11 at 11:21
  • 1
    Well, consider yourself lucky if you get OutOfMemoryError's every 12-16 hours, I get one *every* hour. See http://stackoverflow.com/questions/7766635/redeploying-java-ee-applications-immediately – ustun Oct 28 '11 at 13:14

1 Answers1

0

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.

appbootup
  • 9,537
  • 3
  • 33
  • 65
  • The question is a little outdated, but still these look like good advices, so I'll mark your answer as the correct one. Thanks! – Lorenzo Marcon Dec 21 '12 at 13:54