Reputation: 477
I have an object that I need to cache several of it for a web app in IIS so I am analyzing how much memory each instance use.
I wrote a small exe
and I call GC.GetTotalMemory(true)
before and after construction and the difference is around 335k but if analyze it in CLR profiler
it shows me 22 MB of memory is used for the object which does not make sense.
What am I interpreting incorrectly in CLR profiler ?
Where should I check in profiler to see individual object sizes ?
Upvotes: 5
Views: 547
Reputation: 7958
According to the MSDN: The garbage collector does not guarantee that all inaccessible memory is collected.
CLR profiler shows all the memory allocated;
What if you use GC.GetTotalMemory(false) what is the result?
Upvotes: 1