[Mono-list] RT Os and Mono
jonpryor at vt.edu
Fri Feb 15 13:26:53 EST 2008
On Fri, 2008-02-15 at 19:08 +0100, Lorenzo Viola wrote:
> I see that you point out the GC , are you speaking about Garbage
> Collection ?
Yes, GC == Garbage Collector or Garbage Collection.
> I saw that for example on Mono+ASP.NET the GC could be quite intensive,
> and not forceable (at last on some month ago version)
You can explicitly request a GC by calling System.GC.Collect(), but the
GC can ignore your request. Generally, it's not a good idea to
explicitly force a GC, unless you know what you're doing.
> btw , what do you mean for implicit boxing ? is it a sort of unwanted
> recursion ?
Value types are stored on the stack or "inline" within the object. If
you need a value type to be placed on the GC heap, it needs to be boxed.
Examples of boxing:
object o = 42;
ArrayList a = new ArrayList (); a.Add (42);
Notice that there is no visible indication that boxing is occurring.
> But IF I work by these terms :
> - if the CPU and memory are fast and big enough (like being 10 times the
> ususally needed cpu and memory by the application)
> - if the GC could be forced to start at secure-time-known idle times
> - if the application has been tested and kept as simple as possible not
> to start any unhandled exception , or unpredictable situation
> Would you still not trust such a RT application ?
I would trust it more than the un-GC'd equivalent. The reason? Heap
fragmentation. Without a GC, the heap can become fragmented, eventually
reaching the point that (1) you have enough memory to fulfill a request,
but (2) the memory you have available isn't contiguous, so the request
cannot be fulfilled.
Mono won't currently help here (as it doesn't currently use a moving
collector), but the use of a GC (eventually) permits a moving collector,
which can prevent the heap from becoming fragmented.
In short, the GC isn't necessarily a problem; it's just a different set
of trade-offs compared to manually managing memory (memory leaks vs. GC
overhead, heap fragmentation vs. GC overhead, etc.).
> What also could go wrong ?
Don't tempt fate. :-)
More information about the Mono-list