Red Gate forums :: View topic - GC.Collect at point of snapshot?
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
ANTS Memory Profiler 7
ANTS Memory Profiler 7 forum

GC.Collect at point of snapshot?

Search in ANTS Memory Profiler 7 forum
Post new topic   Reply to topic
Jump to:  
Author Message
chrisgdg



Joined: 14 May 2012
Posts: 1

PostPosted: Mon May 14, 2012 2:43 pm    Post subject: GC.Collect at point of snapshot? Reply with quote

Hi,

I've been profiling the memory of my windows forms application which dynamically loads many WPF Image Viewer controls in an element host. It then disposes of them to load a new set etc.
I managed to discover a memory leak, and fixed it, however, even though i call GC.Collect(), the memory in task manager etc remains high, until i load more images, at which point it momentarily drops, and then raises again. I'm assumign that because the mory is now needed, .NET is removing it from the large heap, and then using it for the new image data.

If however i have the profile attached, and click on the Take Memory Snapshot button (Which, from your documentation calls GC.Collect() before collecting its data), the memory usage drops right down, as if its also clearing the data in the alrge heap.

Are you only using GC.Collect(), or is there anythign else yuou are doing that i could in my code to have the same affect of the actual memory use reducing in task manager?

Thanks,

Chris
Back to top
View user's profile Send private message
Brian Donahue



Joined: 23 Aug 2004
Posts: 6674

PostPosted: Mon May 14, 2012 3:47 pm    Post subject: Reply with quote

Hi,

ANTS Memory Profiler does a GC.Collect before a snapshot to ensure all of the objects that you have correctly disposed arenot reflected as live objects in the results. It's not doing anything special.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group