Red Gate forums :: View topic - Take Snapshot clears memory leak
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

Take Snapshot clears memory leak

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



Joined: 07 Feb 2013
Posts: 1

PostPosted: Thu Feb 07, 2013 4:44 pm    Post subject: Take Snapshot clears memory leak Reply with quote

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.
Back to top
View user's profile Send private message
Chris.Allen



Joined: 12 Mar 2009
Posts: 593

PostPosted: Fri Feb 08, 2013 5:13 pm    Post subject: Reply with quote

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.
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