[Mono-dev] Stop Garbage Collection for a Codeblock

Alan McGovern alan.mcgovern at gmail.com
Thu Mar 8 07:08:11 EST 2007


Just my two cents,

The only reason i can think of where you'd require this kind of behaviour is
when you need real time processing and any kind of delay could be
disasterous. In this case, i wouldn't think C# would be a good choice to
implement in. What you could do is write a C program/library which does that
really special task and call it so that it will remain unaffected by the GC
and will do it's realtime processing in peace.

Hope that helps,
Alan


On 3/8/07, Jonathan Pryor <jonpryor at vt.edu> wrote:
>
> 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
>
>
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20070308/d4781706/attachment.html 


More information about the Mono-devel-list mailing list