[Mono-dev] Stop Garbage Collection for a Codeblock

Jonathan Pryor jonpryor at vt.edu
Thu Mar 8 06:20:48 EST 2007


On Thu, 2007-03-08 at 10:05 +0100, Back, Michael (ext) wrote:
> Is it possible to stop the GC for garbage collecting for a code
> block? 

Simple (yet glib) answer: Don't allocate anything from the GC.  If you
don't allocate GC memory, then the GC won't get involved.  :-)

Sadly, this is the safest solution.  If you disable the GC and the GC
heap runs out of space, what should happen?  An OutOfMemoryException is
probably the only viable choice, which would likely be worse for you
than just having the GC intervene.

 - Jon





More information about the Mono-devel-list mailing list