| Author |
how to detect and ?debug a memory leak
|
peter cooke
Ranch Hand
Joined: Mar 16, 2004
Posts: 310
|
|
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: 16692
|
|
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)
|
 |
 |
|
|
subject: how to detect and ?debug a memory leak
|
|
|