Memory snapshot before / after GC?

Memory profiling for .NET developers

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

Memory snapshot before / after GC?

Postby abcde » Mon Feb 25, 2013 3:45 pm

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?
abcde
 
Posts: 2
Joined: Mon Feb 25, 2013 3:42 pm

Postby jessica.ramos » Tue Feb 26, 2013 6:56 pm

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:
"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/c ... net_memory)
Jessica Ramos
Technical Support
Red Gate Software Ltd.
jessica.ramos
 
Posts: 235
Joined: Mon Apr 23, 2012 1:13 pm

Postby abcde » Wed Feb 27, 2013 10:36 am

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
abcde
 
Posts: 2
Joined: Mon Feb 25, 2013 3:42 pm

Postby yoyovicks » Wed Sep 25, 2013 3:30 pm

I do not agree with this statement:
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.
yoyovicks
 
Posts: 1
Joined: Wed Sep 25, 2013 3:20 pm


Return to ANTS Memory Profiler 7

Who is online

Users browsing this forum: No registered users and 1 guest

cron