dotgnu-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [DotGNU]Garbage Collector


From: Rhys Weatherley
Subject: Re: [DotGNU]Garbage Collector
Date: Fri, 14 Jun 2002 16:07:25 +1000

aneesh george wrote:
> 
> Dear All,
> I heard that CLR of .NET starts GC when someone requests to allocate
> memory and there is no space in .NET managed heap to allocate it. Does
> Portable.NET have the same strategy?

Portable.NET uses the Hans Boehm garbage collector, libgc.
It has its own internal heuristics as to when collection
should occur.  We just call libgc and let it figure out
when to collect.  Portable.NET itself has no other policy
than "use whatever libgc uses".

More information on how libgc works, and when it triggers
a collection, can be found in "pnet/libgc/doc/gcdescr.html"
within the pnet source tree.  The following is a brief
excerpt:

    In non-incremental mode, we make a decision about
    whether to garbage collect whenever an allocation
    would otherwise have failed with the current heap size.
    If the total amount of allocation since the last collection
    is less than the heap size divided by GC_free_space_divisor,
    we try to expand the heap.  Otherwise, we initiate a
    garbage collection.  This ensures that the amount of
    garbage collection work per allocated byte remains
    constant.

Essentially, when the current heap size fills up, it will
make a judgement as to whether it should expand the heap
or force a garbage collection.  It normally does this at
the point of allocation.

Cheers,

Rhys.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]