none
Getting Assembly details and LOH fragmentation details - using CorProfiler RRS feed

  • Question

  • Hi,

    I have my own .Net Memory profiler that's using CorProfiler API. I have developed to profile IIS web Application.
    here, i have few questions.
    1. Using CorProfiler callback method, how to get no.of fragmentation done in LOH?
    2. I can able to get the assembly details such as Assembly name ,Assembly ID and no.of assemblies loaded.
        i. What is dynamically generated assemblies and static assemblies ?
        ii. How to get the stack trace of assembly?


    Monday, June 26, 2017 10:07 AM

Answers

All replies

  • 1) do you mean you want to get a measure of how fragmented the large object heap is? I suppose you could use ICorProfilerInfo2::GetGenerationBounds to get the bounds of the LOH, but getting the size/position of the objects within it might be a problem. My first thought was to use the ICorProfilerCallback2::SurvivingReferences callback, but it only reports id ranges and not individual id's (might still work if the ranges don't include ranges of allocated memory - but I can't confirm that). The only other approach I could think of is to capture the ObjectID of large objects when they are created and track them through the GC callbacks (you will need to update your references if they are moved)

    2) I'm not sure what you are asking.

    i) Again, not sure what you are asking.

    ii) You don't, assemblies don't have stack traces.


    • Edited by Brian Reichle Monday, June 26, 2017 10:20 PM correction
    Monday, June 26, 2017 1:21 PM
  • Hi Brian,

    My second question is,

    Using ProfNativeCallback::AssemblyLoadFinished call back method, can get the AssemblyID and Assembly name.

    But i want to differentiate like (ANTS) what are all the dynamically generated assemblies and what are all the static assemblies?

    can you please clarify me on this? Is there any callback method to get this?


    Tuesday, June 27, 2017 5:26 AM
  • You need to get the static/dynamic state from the module (not the assembly) using ICorProfilerInfo3::GetModuleInfo2 and checking the pdwModuleFlags parameter for the COR_PRF_MODULE_DYNAMIC flag.

    You can use ICorProfilerInfo::GetAssemblyInfo to get the ModuleID of the manifested module from the AssemblyID, but I vaguely recall that it won't work (returns an empty id) until the ICorProfilerCallback::ModuleAttachedToAssembly callback.

    Tuesday, June 27, 2017 11:00 AM
  • Thank you so much .. Brian ):-

    Tuesday, June 27, 2017 11:38 AM