Red Gate forums :: View topic - Memory snapshot before / after GC?
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

Memory snapshot before / after GC?

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



Joined: 25 Feb 2013
Posts: 2

PostPosted: Mon Feb 25, 2013 3:45 pm    Post subject: Memory snapshot before / after GC? Reply with quote

Forgive me if I'm asking in the wrong place for this.

I'd like to take a snapshot of my application's memory usage BEFORE a GC is performed. I suspect there is a memory leak / unnecessary object creation going on somewhere in my app, and would like to see a diff of before/after the full GC. A the profiler forces a GC as soon as I hit 'take memory snapshot', I can't see this data.

Are you aware of how I could view this?
Back to top
View user's profile Send private message
jessica.ramos



Joined: 23 Apr 2012
Posts: 235

PostPosted: Tue Feb 26, 2013 6:56 pm    Post subject: Reply with quote

Thanks very much for your post!

Unfortunately though, there isn't a way you can take a snapshot without forcing a garbage collection. This is for good reason though--without taking a garbage collection, the snapshot would include objects that were still in memory but didn't have any references to them. This could be misleading and also interfere with snapshot comparisons.

I realize you're concerned about the objects created and cleaned up between garbage collections, however I don't think you need to worry about these. To quote one of our artcles:
Quote:

"ANTS Memory Profiler forces a garbage collection when you take a snapshot. ... This behavior will not affect the results that you obtain, because an object which only exists for a short time on Gen 0, and which is never promoted to Gen 1, will never be the cause of a .NET memory problem. "

(http://www.red-gate.com/SupportCenter/content/ANTS_Memory_Profiler/help/7.4/amp_dotnet_memory)
_________________
Jessica Ramos
Technical Support
Red Gate Software Ltd.
Back to top
View user's profile Send private message
abcde



Joined: 25 Feb 2013
Posts: 2

PostPosted: Wed Feb 27, 2013 10:36 am    Post subject: Reply with quote

I'm essentially trying to identify sources of memory churn - I think a before/after GC snapshot would help here, but understand why it's not supported.

Thanks
Back to top
View user's profile Send private message
yoyovicks



Joined: 25 Sep 2013
Posts: 1

PostPosted: Wed Sep 25, 2013 3:30 pm    Post subject: Reply with quote

I do not agree with this statement:
Quote:
ANTS Memory Profiler forces a garbage collection when you take a snapshot. ... This behavior will not affect the results that you obtain


If my object is hold by a weak event then it can receive event notification and fail, but If I do a memory snapshot then I see that my object is only hold by the finalizer queue (I assume it has a finalizer) then I would not understand why my object is receiving an event notification. If I could take a snapshot before a GC then I would see that my object is hold by a weak event and I would understand where the problem is.
So seeing the memory before a GC helps solving problems due to the GC.
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