On Tue, Apr 7, 2009 at 11:01 AM, Pete Turnbull <pete at dunnington.plus.com> wrote:
On 07/04/2009 17:40, Jim Battle wrote:
Garbage collection isn't as trivial as one might think. ?There's a trade-off
between space and time,
Always. The major problem with the MS-BASIC garbage collection was
with the user experience. Gates chose rapid allocation through a
top-of-heap pointer rather using a heap walker. While there was
enough space for allocations, allocations were fast, but reallocation
was impossible except at the top of the heap. Once garbage collection
starts it must proceed to completion. The user experience, with
sufficiently large memory, was of the computer hanging. Most users
would power cycle rather than wait.
The heap walker method slows allocations, but space can be reused
without garbage collection, and once garbage collection is required,
it can be short circuited once a sufficiently large free region is
available for the current allocation.
I can see why you'd want the Gates method on a 2k machine with 300
bytes available for program and data, but once BASIC started using 8K
of address space for its own code on a machine with 32K+ of RAM, they
could have found room for a better allocator and garbage collector.
Eric