Is there an easy way to find leaked objects?

I get large lsit of object in the 'new' view and the same list in the 'show new and dead object difference' view.  Yet when I open any random object in the list and view Shortest Toot Path I get:

There is no root path to display for this object.  The object is not held in memory strongly and is likely to go away after the next garbage collection.  It's still eachable at this moment because it is either weakly refereced or queued for finalization.

I see a Finalizer reference when I select Incoming references by object, and a couple of weak references to other objects that are references by the finalizer.

The main object I am tryign to find memory leaks in, force GC when it is disposed...




 


         private bool ClosePage(TabStripPage page) {
            try {
                if (page == null) return false;

                 page.Dispose();
                 return true;
            } finally {
                GC.Collect();
                GC.WaitForPendingFinalizers();
            }
        }

When I can find a hard reference and free up that memory, I see a difference in the memory total, but it does not disappear from the list, but rather shows up with weak reference instead.  That leaves me with a high confidence that these objects with no root paths are not leaked, but it makes it extremely difficult to find the actual leaks...  I've gone from 2.2 megs leaked to roughly 12-25k leaked and at that size, I'm having extreme difficultly finding anything with a root reference for me to chase down...

Is there any way to force a GC with dotTrace of filter out all objects with no root views?

1 comment

Dear Charles,

Objects which are held only by weak refferences can be alive for a long time until GC decides to kill them. There is no way to help GC in this decision. dotTrace 3.1 does not have the filter to hide this objects. I think we will implement this feature in next version.

WBR, Mikhail Pilin

0

Please sign in to leave a comment.