[Mono-list] Garbage collector in incremental mode?

Fergus Henderson fjh@cs.mu.oz.au
Thu, 10 Oct 2002 20:58:30 +1000

On 09-Oct-2002, Holger Arnold <harnold@gmx.de> wrote:
> Does Mono still work with the Boehm garbage collector switched to incremental 
> mode? Is there a particular reason why this is not done by default?

Here is one possible reason:

 On Fri, 12 Jul 2002, in mail to gclist@lists.iecc.com, Hans Boehm wrote:
 | On a Linux system
 | (and on many others) turning on incremental collection will cause the
 | heap to be write protected.  The collector will handle the resulting
 | write faults, unless they occur inside a system call.  Thus you will
 | need to be careful with, and preferably avoid, system calls that write
 | directly to the garbage-collected heap.  (If the application is
 | single-threaded, or nearly single-threaded, you can also wrap the system
 | calls with some routines provided by the collector.  In some cases, it's
 | also OK to have system calls write to objects allocated with
 | GC_MALLOC_ATOMIC.  But this has turned out to be enough of an issue that
 | I believe there are relatively few clients for the incremental
 | collector.)

In other words, turning on incremental collection would require
carefully vetting the mono source code to make sure that there are no
calls to system calls that might write directly to memory allocated
with GC_malloc() and friends.  There might also be some nasty
interactions with the C interface (PlatformInvoke etc.)

Fergus Henderson <fjh@cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.