Memory Leak in .Net app

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?c3Fsbm92aWNl?=

    #1

    Memory Leak in .Net app

    I have an application that is using around 700MB and causing the memory leak.
    I have used GC.Collect in some methods thought I need to force Garbage
    Collection but the response time has increased than what it was before. I
    tried to dispose objects that i could see but of no help. How can I check on
    my machine my changes for any improvement in memory. What are the key
    measurements I need to look for. any help is appreciated.
  • =?Utf-8?B?YnJ1Y2UgYmFya2Vy?=

    #2
    RE: Memory Leak in .Net app

    if GC.Collect() releases memory than your code is not disposing objects
    correctly. if memory is still high, then you have static objects holding
    resources or real unmanged code leaks. use windbg and sos.dll to debug.

    -- bruce (sqlwork.com)


    "sqlnovice" wrote:
    I have an application that is using around 700MB and causing the memory leak.
    I have used GC.Collect in some methods thought I need to force Garbage
    Collection but the response time has increased than what it was before. I
    tried to dispose objects that i could see but of no help. How can I check on
    my machine my changes for any improvement in memory. What are the key
    measurements I need to look for. any help is appreciated.

    Comment

    • harborsparrow

      #3
      Re: Memory Leak in .Net app

      On Oct 10, 1:02 pm, sqlnovice <sqlnov...@disc ussions.microso ft.com>
      wrote:
      I have an application that is using around 700MB and causing the memory leak.
      I have used GC.Collect in some methods thought I need to force Garbage
      Collection but the response time has increased than what it was before. I
      tried to dispose objects that i could see but of no help. How can I checkon
      my machine my changes for any improvement in memory. What are the key
      measurements I need to look for. any help is appreciated.
      It is unwise to call GC.Collect unless you know what the consequences
      of doing so are. For example, while the GC runs, nothing else runs.
      Not your program, and not anyone else's program. That is possibly
      what is slowing down the app. It is a rare and unusual situation in
      which explicitly calling GC is needed or helpful.

      The proper thing to do is correctly implement IDisposable in all
      classes that use finite resources such as file handles or database
      connections, and then always close database connections or files
      immediately after use (and set the references to them to null). Then
      the system will run the GC only if it ever needs to.

      Comment

      Working...