Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to Identify where Instances of an object are Still Referenced?
    primarykey
    data
    text
    <p>After running the VS2010 profiler with Object Lifetime Tracking in my app, I have this on a particular class :</p> <p><strong>Number of Instances</strong>----------<strong>1 418 276<br></strong> %Total Instances --------------------- %5.8<br> Total Bytes Allocated ------- 158 846 912<br> %Total Bytes -------------------------- %5.94<br> Gen 0 Instances Collected --------- 5 196<br> Gen 1 Instances Collected --------54 894<br> <strong>Gen 2 Instances Collected</strong> ----<strong>747 874<br></strong> <strong>Instances Alive At End</strong> --------- <strong>610 312<br></strong> Gen 0 Bytes Collected ----------- 581 952<br> Gen 1 Bytes Collected ---------6 148 128<br> Gen 2 Bytes Collected ---------3 761 888<br></p> <p>As you cans see, <strong>half of all created instances</strong> end up mainly as <strong>Gen 2</strong>, and <strong>the other half is staying alive until the end of the App</strong>. [<em>ha, ha, ha, ha, staying alive, staying alive...</em> -> <em>Ok sorry, I could'nt resist...</em>]</p> <p>What bothers me is that these instances should have a very short lifetime (It's basically a datafield class - that could be a struct, but I preferred to make it a class to "activate" GC on it). <br>These instances are created by reading very large binary files (each line being a class/ a record) and passed via a small sized queue by delegate/event to workers that basically just read it, put it in queues (which are <em>very regularly</em> dequeued), and then terminate (background workers ending normally). I guess Events are unsubscribed to when workers no more exist.</p> <p>So, <strong>is there a way to identify where are these references hiding</strong> ? Because if they are not GC'd they ARE still referenced somewhere, but how to tell for sure ? I'm tired of guessing and trying so many hypothesis SO if somebody has more rational guidelines or a fair checklist and/or tools / precise profiler places to look at, I welcome it.</p> <p><strong>Complementary Resources to the Answers</strong><br> <a href="http://blogs.msdn.com/b/mohamedg/archive/2010/03/02/visual-gcroot-via-dgml.aspx" rel="nofollow">Visual GCRoot via DGML</a> - Thanks to Richard Szalay<br> Also, this video <a href="http://www.screencast.com/t/NWY2Njcx" rel="nofollow">GCRoot Demo</a> from Chris Lovett is very educative on the subject. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload