Re: HP48 garbage collection Message #8 Posted by James M. Prange on 6 Oct 2004, 2:49 a.m., in response to message #5 by Francesc Casanellas
Raymond mentioned RPL, not RPN. RPL does
use Reverse Polish Notation, but it's not the same programming
language used on earlier HP RPN models, and "Garbage Collection"
is very much part of RPL. Actually, it may better be considered
"Memory Packing"; it's a matter of moving still referenced objects
in temporary memory to occupy contiguous memory, overwriting
unreferenced objects. Garbage collection is done whenever the
amount of free memory gets too low.
In general, having more free memory means that garbage collection
won't need to be done so often, but when it is done, it takes
longer. This explains why it's less noticeable on a 48S/G (or
48SX/GX without any merged memory).
Of course, fewer objects (actually, pointers to objects) on the
stack will generally result in a faster garbage collection too.
Avoid filling up the stack with objects that you no longer need.
John H Meyers wrote some posts on reducing free memory so that the
garbage collections were fast enough to be less of an annoyance to
some. Personally, I prefer less frequent garbage collections, even
though they do take longer. See
this
search for some of John's posts on this matter. He might
have something about it on http://www.hpcalc.org/ too.
Garbage collection can be drastically slowed when the stack
contains many pointers into composite objects. Typically, the
composite will be a list type object. See
my
post for some demonstration programs on this effect. Note
that if you know that a program could suffer from this, then you
might be able to avoid it by forcing a garbage
collection ahead of time.
Regards, James
|