Re: GC.Collect can be trusted?



"Ward Bekker" <wDotbekker@RemoveThisequanimityDotnl> wrote in message news:eSYj4tngHHA.5052@xxxxxxxxxxxxxxxxxxxxxxx
Hi Cristopher,

My definition of a memory leak for managed frameworks:

All objects that should be garbage collected, but can't because they are still referenced by other objects that will not be garbage collected ;-)


Objects that are still referenced should not be GC, that would be a serious bug if the GC collected such objects ;-)
The problem you are describing is not a real "memory leak", the problem is that you don't know who's keeping a reference to the object, so you aren't able to release the object by setting it's reference to null, this is an application bug disguised as a leak.
A "real leak " is part of the memory, occupied by a "non referenced object" staying allocated on the GC heap after a GC run, if the GC can't deallocate the memory it will stay in the heap until the process terminates, no-one is still under control of this chunk of memory. Or otherwise, a leak in the managed heap is the result of a CLR bug, possibly a GC bug.

Willy.

.



Relevant Pages

  • Re: allocatable non-dummy local variables and pointers to them
    ... My somewhat fualty memory says that the leak persisted. ... bugs would be a compiler bug. ... but the persistance would be an OS bug. ...
    (comp.lang.fortran)
  • Re: Memory leak or expected behavior?
    ... >each web page bump the memory out, and as we know it's not given back ... My experience with objects 'leaking' memory (not a true leak, ... In Tk you need to reuse objects, because it keeps a reference to ... photo objects to handle what will be on-screen at any one time. ...
    (comp.lang.perl.misc)
  • [PATCH] fix memory leak in mm/slab.c::alloc_kmemlist() (try #2)
    ... This should fix the leak and coverity bug #589 ... Currently the only caller of alloc_kmemlistwill BUG() if alloc_kmemlist ... be leaking memory when we return -ENOMEM. ...
    (Linux-Kernel)
  • Re: memory leak in DBI XS bootstrap code
    ... I just ran valgrind with your fix - there seems to still be a leak. ... The trick is to use newSV to alloc memory in the form of an SV ... >> The file called INSTALL in the perl source code directory. ... without telling perl its a reference. ...
    (perl.dbi.users)
  • Re: Matching multiple subexpressions in a regular expression
    ... so I presume the code is somehow leeking memory. ... there is a bug in ... S> either English or $& causes the memory leak. ... it is a well known ram suck but it doesn't ...
    (comp.lang.perl.misc)