wood burning stoves 2.0*
The moose likes Java in General and the fly likes how to detect and ?debug a memory leak Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "how to detect and ?debug a memory leak" Watch "how to detect and ?debug a memory leak" New topic
Author

how to detect and ?debug a memory leak

peter cooke
Ranch Hand

Joined: Mar 16, 2004
Posts: 314
I had an interview question "how do you detect and debug a memory leak.
Since I have never debugged a mem leak. I was not sure what to do.
what is the suggestion.


from a systems admin perspective, "you eventually get an out of memory error. and the app has to be killed and restarted because prod can't be down long enough to debug it"

from a developer perspective " have jprobe watch a stress test version of the app and hope it get it"


CIAO Peter M. Cooke
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18765
    
  40

peter cooke wrote:
from a developer perspective " have jprobe watch a stress test version of the app and hope it get it"


Hoping is generally not a good debugging technique.... well, it may work, but it's not a technique...

You need to really understand your application too. For example, you put a profiler on the application, and it says there is a million instances of class Foo, is it a memory leak? Or is the application supposed to have a million instances?

And a leak doesn't have to show up as one instance type. It could be a steady growth of many instance types. You need to understand how your program is supposed to grow based on usage.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
 
wood burning stoves
 
subject: how to detect and ?debug a memory leak