Take Snapshot clears memory leak

Memory profiling for .NET developers

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

Take Snapshot clears memory leak

Postby krispenner » Thu Feb 07, 2013 4:44 pm

Hi,

I am new to ANTS Memory Profiler.

I am trying to understand why my app runs at around 80MB but after my business logic runs it reports to be at 7.5GB in both the Task Manager and Resource Monitor. Taking a baseline snapshot before and then a comparison snapshot after fails to identify memory leak because it cleans up my apps memory during the snapshot somehow. Why?

Windows 2008 R2
.NET 4.0 Windows Service

Business Logic is:
Every 24 hours, create 1500 Tasks which create 1 HttpWebClient connection each, and saves the downloaded content to a file on disk.
- 1500 .NET Logical Threads (Tasks)
- 1500 HttpWebClient connections)
- 1500 files written to disk
All connections and file handles have Dispose() called on them

I attach ANTS Memory Profiler and take a snapshot at 80MB (baseline)
After business logic is finished executing the memory is at 7.5GB, 10,000 with page faults. Task Manager, Resource Monitor and ANT Memory Profiler all shows memory is way up at 7.5GB and this wil remain for ever (months) if I do not restart the service - eventually my machine becomes unresponsive (3 weeks).

I take a second Memory Snapshot, it reports 80MB, both Task Manager and Resource Monitor show drop from 7.5GB to 80MB at time of snapshot taken. This always happens when taking a snapshot, it clears the apps memory.

So my question is:
What is ANTS Memory Profiler doing to my app during a snapshot that causes the memory in my app to be cleaned up and hence no memory leak is reported?

Thanks for any help.
krispenner
 
Posts: 1
Joined: Thu Feb 07, 2013 4:27 pm

Postby Chris.Allen » Fri Feb 08, 2013 5:13 pm

Taking a Snapshot runs GC.Collect() every time.

Memory usage data is only updated *after* a GC so intra-GC data is not 100% reliable.
Chris.Allen
 
Posts: 594
Joined: Thu Mar 12, 2009 4:17 pm


Return to ANTS Memory Profiler 7

Who is online

Users browsing this forum: No registered users and 0 guests