Hi Lindsay, Joh-Tob,
On Fri, Mar 03, 2017 at 12:47:12PM +0100, Joh-Tob Schäg wrote:
> > Is the garbage collection in picolisp immediate if the resource can be
> > released?
> No, picolisp uses a mark and sweep halt the world garage collector. During
> sweep phase the complete allocated RAM is checked. If that would happen
> after each release of a resource picolisp would be very slow.
Yes and no. It is correct that the garbage collector does not run at each
release. Instead, it runs when a new cell is needed and the current heap is
found to be full.
So garbage collection is indeed "immediate", in that as long as there is free
memory no collection is needed, and if not, the collector runs (typically just a
If after a collection still no cells are available, the heap is increased.
Therefore, if a program slowly allocates more and more memory, it helps intially
to allocate a bigger heap, e.g. (gc 800) or whatever size is needed in the long