Lots of threads and memory usage for processes 'java' on Mac OSX 10.6.7
Asked Answered
N

1

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?

Northwesterly answered 2/4, 2011 at 10:42 Comment(4)
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).Tridentine
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.Northwesterly
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.Northwesterly
Well, consider yourself lucky if you get OutOfMemoryError's every 12-16 hours, I get one every hour. See #7767135Commence
R
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.

Rexferd answered 13/12, 2012 at 8:16 Comment(1)
The question is a little outdated, but still these look like good advices, so I'll mark your answer as the correct one. Thanks!Northwesterly

© 2022 - 2024 — McMap. All rights reserved.