ForthOS Dynamic/Bucket Memory Allocator


While ForthOS also offers the traditional Forth heap memory allocator ("allot", ",", "here", "forget"), there are many applications where it is easier if memory objects are allocated and freed in an arbitrary order. The ForthOS bucket memory allocator is available for these purposes. Both methods of allocation can coexist; the Forth heap grows from lower memory upward, and the bucket allocator takes memory from the top of memory downward.

The Words

Other Considerations

Unlike the Forth heap memory, bucket memory is not preserved across an "unexec" operation.

The memory is organized in "buckets" which increase by powers of two. Thus, the actual memory consumed can be quite a bit larger than the size you actually requested. This scheme is used because it is much more resistant to memory fragmentation than "best fit" type allocators.