GC.Collect at point of snapshot?

Memory profiling for .NET developers

Moderators: Luke Jefferson, StephenC, AndrewH, melvyn.harbour, james.billings, Laura Morley, dene.boulton

GC.Collect at point of snapshot?

Postby chrisgdg » Mon May 14, 2012 2:43 pm

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
chrisgdg
 
Posts: 1
Joined: Mon May 14, 2012 2:36 pm

Postby Brian Donahue » Mon May 14, 2012 3:47 pm

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.
Brian Donahue
 
Posts: 6668
Joined: Mon Aug 23, 2004 10:48 am


Return to ANTS Memory Profiler 7

Who is online

Users browsing this forum: No registered users and 0 guests

cron