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.

Moderator: SciTech Software

clean up does not clean constructor

Postby 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
bhargava381
 
Posts: 9
Joined: Thu Jun 04, 2015 8:44 pm

Re: clean up does not clean constructor

Postby 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
Andreas Suurkuusk
 
Posts: 962
Joined: Wed Mar 02, 2005 7:53 pm
Location: Sweden

Re: clean up does not clean constructor

Postby bhargava381 » Wed Feb 10, 2016 11:58 pm

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


Return to Known Memory Issues

Who is online

Users browsing this forum: No registered users and 2 guests

SciTech Software logo

© Copyright 2001-2016. SciTech Software AB
All rights reserved.


SciTech Software AB
Kartvägen 21
SE-175 46 Järfälla
Sweden


E-mail: mail@scitech.se

Telephone: +46-706868081