.Net application Eating Memory & releases when minimized

Dear all,

I have developed an application based on C#, The problem is "Garbage Collector being not called" from the application, i have not used any unmanaged code. The application is a Multithreaded application and the Memory Usages figure in Task Manager comes to minimum when i minimizes the application. Example: Task manager's Mem Usage is showing 328 MB and on minimizing the application it shows 45 MB.

thanks in advance...

aniruddh



Answer this question

.Net application Eating Memory & releases when minimized

  • KRSE

    you can try forced garbage collection but that also doesn't give you 100% assurance.

    http://DotNetWithMe.blogspot.com
    vikas goyal



  • HbH

    Hi Aniruddh

    Why do you think the GC is not running

    Maybe this MSDN article can help you isolate your problem:

    http://msdn.microsoft.com/msdnmag/issues/06/11/CLRInsideOut/default.aspx

    Hope that helps

    -Chris


  • David Scherf

    Aniruddh,

    Does those objects created inside the loop have Finalize methods Can you remove that and try because Finalizable objects will survive 1st GC cycle and be moved to higher Generations making them to be collected on the next GC cycle only.

    Thanks,

    Suresh.


  • pravinarote

    hi Chris,

    i am making an object of a particular class inside a for loop, when the control goes outside the loop those objects are not disposed. i am seeing in a memory profiler that other objects are being removed(when they go out of scope) but not this one and because of this application is throwing an OOM exception.

    Aniruddh


  • aliasx

    Hi Aniruddh

    Task Manager is unfortunately a very poor way to measure how much memory your application is using. What you're seeing is "working set", and Windows automatically trims an application's working set when it is minimized. This goes for both managed and native applications. Please see the following article for more information: http://getdotnetco.web119.discountasp.net/GdncStore/free/Articles/The%20Memory%20Mystery.htm

    The recommended way to measure how much memory a managed application is using is through the Performance Counters.

    Hope that helps

    -Chris


  • chris441962

    Thanks Chris, thanks for coming forward...

     

    I have seen my application on some Memory profilers.... ya that is eating memory, the main problem is with Garbage collection. i have called Finalize and even Dispose but even though Garbage collector is not being called (i hav tested that on Memory Profiler).

     

     

     


  • Sandro Borsatto

    Hi Aniruddh

    Check out this article: http://blogs.msdn.com/ricom/archive/2004/12/10/279612.aspx

    It explains how to track down managed memory leaks and find out what is holding references to objects in memory, and preventing them from being collected.

    -Chris


  • .Net application Eating Memory & releases when minimized