Competition: What’s your favorite Redgate tool? Enter now.

Memory disappears on taking snapshot

Hello,

We are facing a unusual situation with our code. We have memory leak in our application because of which there are multiple operations (same operation repeated n times) when we do action. This behaviour is consistent.

Now as soon as we take snapshot using ANTS, the application works correctly and there are no leaks. Only one instance remains.

This problem is pretty awkward. may be we have some initialisation wrong way, but it is difficult to find the retention path since there is nothing in snapshot. We did tried collecting GC explicitly but that didnt helped.

I used below code as well but nothing gonna work.
GC.Collect(2, GCCollectionMode.Forced, true);
GC.WaitForPendingFinalizers();

It

Any help would be appreciated.
Tagged:

Comments

  • Jessica RJessica R Posts: 1,308 Rose Gold 4
    Hi @ravipatni,

    Thanks for your post!

    When you take a snapshot, the profiler runs:

    GC.Collect();
    GC.WaitForPendingFinalizers();
    GC.Collect();

    If you add another Collect() call at the end, does that make any difference?

    If not, we've seen one similar case before where the memory behaved when the application was profiled. The issue there ended up being that a finalizer suppress was keeping everything in memory, but once it was removed from the disposal pattern, everything cleaned up as expected.

    Does this sound like it may be the case here?

    Jessica Ramos | Product Support Engineer | Redgate Software

    Have you visited our Help Center?


Sign In or Register to comment.