Re: Memory management



Keith Wright wrote:
 > > However, no garbage collection algorithm is
 > > ever as efficient as throwing away garbage when you know that it
 > > is garbage.
 > 
 > Well, that's just not true.  If you have complicated data structures
 > and garbage is created very quickly it can be slower to do the
 > bookkeeping needed to determine when something becomes garbage
 > and trace through the garbage freeing it a bit at a time, than
 > simply to ignore it until the crisis, then trace the small
 > amount of non-garbage and recycle the rest in one big chunk.
 > 
 > On the other hand, if garbage is created very slowly, the program
 > may print the answer and terminate before you ever need to 
 > call the GC at all.

Fair comment. (:

Perhaps I should have said that it is more efficient to apply the
knowledge that you have to discard garbage than to allow another
algorithm to regenerate that knowledge. However, your second case
provides a probablistic counter-example to that as well. 

Still, where would mailing lists be without fuel for the flames?

Felix



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]