[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [DotGNU]Garbage Collector
From: |
Boris Kolar |
Subject: |
Re: [DotGNU]Garbage Collector |
Date: |
Fri, 14 Jun 2002 12:56:57 +0200 |
> Essentially, when the current heap size fills up, it will
> make a judgement as to whether it should expand the heap
> or force a garbage collection. It normally does this at
> the point of allocation.
I'd like to point out that this strategy may cause the concept of object
finalization useless. The same problem appears in java (see
an excellent article at
http://www.eclipse.org/articles/swt-design-2/swt-design-2.html). The strategy
may also lead to poor
performance when garbage collection starts.
A better approach (at least in some cases) would be to (incrementally) garbage
collect an object immediately after it's no longer
reachable.
Ideally, the programmer would have the ability to decide garbage collection
strategy for each object (for example, by implementing
interface IncrementallyCollectable, the object would be garbage collected
immediately after it's no longer needed). A smart compiler
could also optimize the code by choosing the most appropriate gc method for
each object.