"leaks" in .net

This is a discussion on "leaks" in .net within the C# Programming forums, part of the General Programming Boards category; can anyone refer me to either good tools or reference articles for .NET memory management? i am having some issues; ...

  1. #1
    3735928559
    Join Date
    Mar 2008
    Location
    RTP
    Posts
    839

    "leaks" in .net

    can anyone refer me to either good tools or reference articles for .NET memory management?

    i am having some issues; i've been using memProfiler, and it helped me eliminate 90+% of the mem bloat i was experiencing, but it still says there are live instances of objects that, as far as i can tell, don't have any dangling references to them!

    thanks in advance.

  2. #2
    Gawking at stupidity
    Join Date
    Jul 2004
    Location
    Oregon, USA
    Posts
    3,159
    Are you sure the GC has run since the last reference was removed?
    If you understand what you're doing, you're not learning anything.

  3. #3
    3735928559
    Join Date
    Mar 2008
    Location
    RTP
    Posts
    839
    no; i'm not sure how to tell. i am calling GC.collect() though.

  4. #4
    a_capitalist_story
    Join Date
    Dec 2007
    Posts
    2,639
    This is why I prefer handling my on memory management (i.e., using C/C++). It seems harder to me to find the objects that have been pinned in C#. Tracking down managed memory leaks (how to find a GC leak) - Rico Mariani's Performance Tidbits - Site Home - MSDN Blogs

  5. #5
    3735928559
    Join Date
    Mar 2008
    Location
    RTP
    Posts
    839
    i agree; i hate it, frankly. I highly prefer C++. unfortunately, that's not an option for me at present.

    thanks for the links.

  6. #6
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,584
    I have experienced these leaks as well and the GC is the laziest GC I've ever come across. There are several tools available that can help you. One is from MS and it is the CLR profiler. The most recent version is .NET 2.0 but I can confirm it works up to 3.5. It is a bit non-intuitive and the graphs are confusing at first but the summary page will tell you how many objects you have and what generation they are in. If you have a lot of dangling references your gen2 size will be pretty significant. There are several more but you will have to Google for them as I forget where I d/l them from.

    Of course you can always tell the GC to collect but make sure you check out the params you can pass to this function. Call collect with no parameters is not recommended and will decrease your performance.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. migrate from .Net 2.0 to .Net 3.0
    By George2 in forum C# Programming
    Replies: 3
    Last Post: 07-25-2007, 04:07 AM
  2. Some .NET Distribution Stats
    By nickname_changed in forum C# Programming
    Replies: 2
    Last Post: 05-14-2005, 03:41 AM
  3. IE 6 status bar
    By DavidP in forum Tech Board
    Replies: 15
    Last Post: 10-23-2002, 05:31 PM
  4. .net
    By ygfperson in forum A Brief History of Cprogramming.com
    Replies: 18
    Last Post: 02-15-2002, 12:15 AM
  5. Visual J#
    By mfc2themax in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 10-08-2001, 02:41 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21