Getting more details on a specific memory leak
My memory leak looks like this:
Having not that much experience with the开发者_如何转开发 Eclipse Memory Analyzer
i wonder if it can answer those two questions:
- What's the source code position where most of those instances were allocated?
- What's the reason they were not garbage collected?
- Did they stop but are still referenced somewhere?
- Are they still executing or sleeping?
EDIT: Looks like sbridges was right and my threads just never die. However i'm not really sure of the reason since the stacktrace doesn't seem to contain any of my code. The way i use ExecutorService must be wrong somehow.
Somewhere your code is creating threads, and those threads never die. Threads can't be garbage collected, since a thread is a gc root. The easiest way to debug this will be to start the app, wait until you have a large number of threads, then connect to the app with JConsole, and look at the stack traces of the threads. To see stack traces, click on the threads tab and click on a thread under live threads.
精彩评论