locked
CLR Profiler - How to get the Object deallocation details RRS feed

  • Question

  • Hi,

    My CLR profiler which is to find the Object Allocation details in my web application. 
    The web application has the code like below,

    Test t = new Test();	
    Dummy d = new Dummy();

    When this code is running , My CLR Profiler is able to get the object ID,class ID ,class name and object size.

    i used the callback "ICorProfilerCallback::ObjectAllocated"  to get those details.

    Is there a way to find out the  object details (object ID,class ID ,class name and object size) when this object getting deallocated/cleaned up..?
    I have also checked GC callbacks which didn't give me those details. 

    Thanks,

    Durai



    Tuesday, March 14, 2017 10:15 AM

Answers

  • Managed objects cannot be resized or change their type during their lifetime, so whatever it was at allocation time, it will be at deallocation time. If you have the ObjectID of something you want to track, then you can update your tracked values in the MovedReferences callback (if you don't update them, then they become garbage).

    As for when deallocation takes place. You can infer this from the object references not reported by MovedReferences or SurvivingReferences during collection (between GarbageCollectionStarted and GarbageCollectionFinished).


    Tuesday, March 14, 2017 11:55 AM