[fpc-devel] Modernising Pascal

peter green plugwash at bircd.org
Sun Feb 27 05:23:47 CET 2005

> -----Original Message-----
> From: fpc-devel-bounces at lists.freepascal.org
> [mailto:fpc-devel-bounces at lists.freepascal.org]On Behalf Of DrDiettrich
> Sent: 26 February 2005 03:34
> To: FPC developers' list
> Subject: Re: [fpc-devel] Modernising Pascal
> Jamie McCracken wrote:
> > GC is very inefficient with memory and current implementations tend to
> > cost a lot performance wise too.
> I don't see how GC is inefficient with memory?
> Reference counting and (mark/sweep) garbage collection have a different
> runtime behaviour: Reference counting occurs with many references to
> objects, whereas GC only runs when required, or when idle time is left.
one thing i have heared (i don't use garbage collected languages much so
i've never seen this myself) is that the GC gets some CPU time and starts
causing stuff to be swapped in. This slows other threads down which gives
the GC more CPU and causes more stuff to be swapped in.

another effect that i have seen is when CPU usage is high a garbage
collected app can suck up all the systems memory. It can get all the memory
it needs for itself because it can force run its garbage collector when it
runs out but no other app on the system can.

some objects may use resources other than memory which are more valuable and
need to be freed asap.

refcounting doesn't suffer from any of theese issues

also note that use of const parameters can eliminate a huge amount of
refcounting overhead.

More information about the fpc-devel mailing list