Hi Kevin, For an object to be GCed, no other object should hold reference to it. So you need to know who is holding a reference to the object which you suspect is leaking.To do so in Eclipse Memory analyzer, right-click any object in the tree, select "List object --> with incoming references". If you expand the tree, you will find out with object is holding a reference to your object recursively. Then you have to read the code to find out if it is really leaking. What you can also do is take a heap dump at the start, another one at the end and compare the objects in the "histogram" view. This is what I usually do. Regards,Adel
> Date: Fri, 29 Jul 2016 06:53:15 -0700 > From: [email protected] > To: [email protected] > Subject: [JAVA-Android]Memory Leak Investigation > > Hi all, > > I am using a slightly modified version of QPID to communicate with Microsoft > Azure IoT Hub called proton-j-azure-iot-0.12.2. > > So straight to the problem. I am investigating a memory leak when using a > HandlerThread class to post a task. > > Here is the rough code snippet : > > > > I've been reading a lot lately about Handler Thread so the structure above > was chosen because it takes care of Looper management. > > So after running for 24 hours, the heap dump is run through Eclipse Memory > Analyzer and it suggests that the memory leak suspect is a lot of Thread not > being garbage collected. The heap increases 3MB after running roughly 16 > hours. > > <http://qpid.2158936.n2.nabble.com/file/n7648353/thread.png> > <http://qpid.2158936.n2.nabble.com/file/n7648353/suspect.png> > > It seems to me that the HandlerThread class implementation is correct (I > follow this: > https://blog.nikitaog.me/2014/10/11/android-looper-handler-handlerthread-i/ > ). And just by looking at the Dominator tree in MAT, it is not obvious where > the problem can be. > > I've been pulling my hair out and searching through StackOverflow on memory > leak problem regarding THread operation but haven't found any concrete > solution to this. > > Has anybody come across this before or How can I find out where the problem > is given all the tools that I have (Android studio and MAT)? > > Any help appreciated. > Many thanks for reading > > > > -- > View this message in context: > http://qpid.2158936.n2.nabble.com/JAVA-Android-Memory-Leak-Investigation-tp7648353.html > Sent from the Apache Qpid users mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] >
