locked
.Net Memory leak RRS feed

  • Question

  • Hi,

     

    I have developed an application in C# .Net in which I need to display information. There are about 1627 labels added inside the Panel. I am disposing all the labels everytime I refresh the view. But still the memory is not being released and it goes on increasing.

     

    How to tackle this issue?

     

    Thanks & Regards.

     

    Pawan Kirtikar

     

    Thursday, May 29, 2008 2:09 PM

Answers

All replies

  • Hi Pawan,

     

    Disposing won't release managed memory taken by these objects. You need to ensure that form, or any other classes do not keep references to these labels.

    • Proposed as answer by Bruno Yu Tuesday, June 3, 2008 6:38 AM
    Thursday, May 29, 2008 2:38 PM
  • have you tried building the app in release mode with optimizations turned on?
    Friday, May 30, 2008 12:31 AM
  • I would love to see how you are using 1600 labels on one panel.  Can you post a screenshot?  It would seem that your current approach can probably be simplified as I can't think of any reason to use that many labels.  Provide some details as to what you are trying to accomplish.
    Friday, May 30, 2008 8:02 PM
  • For advanced diagnostics (to see which objects aren't being freed and why), I recommend you read my post: http://blogs.microsoft.co.il/blogs/sasha/archive/2008/04/08/next-generation-production-debugging-demo-2-and-demo-3.aspx

    It covers using SOS.DLL and WinDbg to diagnose .NET leaks, and to visualize them using CLR Profiler
    Sasha Goldshtein | http://blogs.microsoft.co.il/blogs/sasha
    • Marked as answer by Bruno Yu Tuesday, June 3, 2008 6:37 AM
    Saturday, May 31, 2008 10:50 AM