Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to detect and ?debug a memory leak

 
peter cooke
Ranch Hand
Posts: 317
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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"
 
Henry Wong
author
Marshal
Pie
Posts: 21513
84
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic