[Mono-list] How to use the Boehm garbage collector

HannibAl Bundie hannibalbundie@hotmail.com
Mon, 03 May 2004 14:53:21 +0200

Thanks for your answer.

So, theoretically, I do nothing and I can benefit from an effective 
collector ?
Nevertheless, I would like to force a garbage collection. In this case, what 
namespace I have to use in the aim to apply a GC_gcollect() ?

Thanks and sorry this probably stupid question

>From: Jonathan Pryor <jonpryor@vt.edu>
>To: HannibAl Bundie <hannibalbundie@hotmail.com>
>CC: mono-list@lists.ximian.com
>Subject: Re: [Mono-list] How to use the Boehm garbage collector
>Date: Mon, 03 May 2004 07:05:27 -0400
>On Mon, 2004-05-03 at 05:30, HannibAl Bundie wrote:
> > After the installation of gc6.2 I don't know what I have to do. I have 
> > that I must rebuilt the mono core environment, but I have installed mono
> > with RPM packages. So, is there any other way to use Boehm collector ?
>What are you trying to do, exactly?  Mono already uses Boehm GC 6.2,
>which is included with the mono source tree (along with some
>Mono-specific patches).
>If you want to use a different Boehm GC, you have to rebuild Mono from
>source.  Period.  When configuring Mono, give it the --with-gc=boehm
>argument to use an already installed Boehm GC.  The default is
>--with-gc=included, which uses the Mono-provided Boehm GC.
> > Also, I would be very grateful if I could have an example of the use of
> > Boehm collector with a C# program.
>C# runs in a garbage collecting environment.  To use the Boehm
>collector, or any collector for that matter, you...do nothing.  That, of
>course, is the whole point to GC systems -- the programmer doesn't need
>to do anything.  Just keep allocating memory, and the GC will
>automatically collect it when memory runs low.
>There are some caveats.  You need to make sure that the memory can be
>collected, that your memory is actually garbage at some point.  You can
>speed up the process by nulling out fields and variables when you no
>longer use them.  Long-living GC objects can slow things down,
>especially if they're *large*, long-living objects...
>MSDN has a variety of articles describing what programs can do to make
>the GC more efficient.
>  - Jon
>Mono-list maillist  -  Mono-list@lists.ximian.com

Recevez par e-mail des émoticônes pour MSN Messenger