clean up does not clean constructor

Use this forum to read, ask or inform about memory issues in the .NET Framework and third party components.
Post Reply
bhargava381
Posts: 9
Joined: Thu Jun 04, 2015 8:44 pm

clean up does not clean constructor

Post by bhargava381 » Tue Feb 09, 2016 11:42 pm

Hi Admin,
We have been using this .net memory profiler for a while. Recently, we started the optimization cycle and when we started profiling the application. We have noticed some unexpected behavior
This is what is happening:
When I close the view , the actual view gets removed from the memory .But, the constructor still retains in the memory after clean is done.
Can you please review and suggest the needful

Thanks,
Bhargava
Attachments
Profiler result.PNG
Result after closing the view. As you can see the constructor still retains in the memory but the actual mainpage gets cleaned when view is closed.
MainPage Constructor Need Dive information.PNG
deep dive information of the mainpage constructor

Andreas Suurkuusk
Posts: 1000
Joined: Wed Mar 02, 2005 7:53 pm

Re: clean up does not clean constructor

Post by Andreas Suurkuusk » Wed Feb 10, 2016 8:24 pm

The MainPage.c<> class is not the view constructor. It's a helper class created by the compiler to implement anonymous delegates. Only one instance of this class will be created, and it will not be GCed until the AppDomain shuts down (it has a static field reference as a root). The size of the instance is only 12 bytes and since only one instance gets created, it's not a memory leak, just an implementation detail.

I hope this helps.
Best regards,

Andreas Suurkuusk
SciTech Software AB

bhargava381
Posts: 9
Joined: Thu Jun 04, 2015 8:44 pm

Re: clean up does not clean constructor

Post by bhargava381 » Wed Feb 10, 2016 11:58 pm

Thanks..

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests