none
perfview: unreachable memory RRS feed

  • Question

  • Hi folks,

    I'm using perfview for .net memory leak analysis and I was wondering what unreachable memory is representing?  I see a sizable difference in unreachable memory between two dumps that is considerable so I was curious.  Would this be the same as "private bytes" using other tools like vmmap from sysinternals?

    thanks,

    JJ



    Wednesday, August 14, 2013 4:19 PM

Answers

  • unreachable is what happens to an object or memory block when there are no more references to it.  The garbage collector loves to collect unreachable memory.  But the garbage collector likes to be lazy though too, so consecutive dumps might reveal that the garbage collector didn't make an effort to collect some unreachable memory between your two dumps.

    So it's normal.  This is an intermediate state that memory has after you release all the references but before it is garbage collected and eventually doled out by the allocator again in the future.

    Here's an extended analogy:

    Imagine you are in a boat and you tie a rope to an anchor and submerge it in the lake. You can get your anchor back if you pull in the rope.  You can lower two anchors with two ropes and still get both of them back.  You could even tie two or more ropes to the same anchor and cut one of the ropes and you don't lose your anchor because you can still pull it up with one of the other ropes.  But if you ever let go of all the ropes attached to one anchor, it becomes unreachable.  It's sunk.  It's still down there, you just can't reach it.  It's unreachable.

    ...by you.

    Because eventually the garbage collector comes along with special submarine equipment that can collect things that are on the bottom of the lake.  But they don't return your anchor to you.  They keep all the junk they find down there and give it back to the anchor store, who would be happy to sell you a new anchor -- you might even get the one you lost, but probably not.

    (The ropes are references and the anchors are objects, in case I didn't make that clear.)

    Wednesday, August 14, 2013 7:50 PM