What are the challenges you face when working across database platforms? Take the survey
Options

Instance retention graph class notation

CenturySpineCenturySpine Posts: 5
edited December 3, 2015 6:59AM in ANTS Memory Profiler 8
Hello

I used AMP8 to successfuly track my memory problems and I almost cracked everything down except for one thing : I have one last "thing" that seems to retain my class but I can't figure out what it is.

It seems to be a static property or field given the information provided by the profiler : "object is a GC root because it is in the static variable InternalStoreCardsViewModel+<>c.<>9" which is not very explicit :)

"InternalStoreCardsViewModel" here is the class I expect to be garbage collected.

I checked and I don't have any static field or properties (I checked parent classes also) in this class BUT I make some calls to static class methods.

How can I figure out what is this last thing retainaing my class from being garbage collected ?

Thks in advance !

Comments

  • Options
    Hi Century,

    It looks like a compiler generated variable related to that class. You should look for lambda methods in that class which reference things outside their own immediate method body. When you do that, the compiler takes a copy of the things you use, which generates a reference and keeps them in memory.

    Lambda expressions are not represented as objects in themselves at the level of IL in the CLR, but are represented as compiler-generated classes which are used to maintain references to what were the local variables.
    Have you visited our Help Centre?
Sign In or Register to comment.