Hi all,
I've been trying to work out why this object is hanging around hogging memory when I had thought I had set all references to it to null.
I did a heap dump and looked at it with the Eclipse Memory Analyzer. After getting rid of the few references I had missed, I'm still stuck with one -- going back to the Busy Monitor. (Which I don't quite understand, for forgive me if I misuse terms...)
Shortest path to GC roots:
javax.swing.TimerQueue Busy Monitor
- firstTimer javax.swing.Timer
- listenerList javax.swing.event.EventListenerList
- listenerList java.lang.Object[2]
- [1] org.mycompany.MyObject$1
- this$0 org.mycompany.MyObject
So I gather that the Busy Monitor has to do with any threads that use wait(), notify() or are in synchronized blocks. Well, I do have a thread that I call notify() on in a synchronized block in that class, but when I want to destroy my object, in my destroy() method I call "myThread = null." (And myThread is private, so nothing else should have it). Shouldn't this work to kill it? Why is it sticking around?
Any help greatly appreciated.