The OpenD Programming Language

FreeTree.allocate

Allocates n bytes of memory. First consults the free tree, and returns from it if a suitably sized block is found. Otherwise, the parent allocator is tried. If allocation from the parent succeeds, the allocated block is returned. Otherwise, the free tree tries an alternate strategy: If ParentAllocator defines deallocate, FreeTree releases all of its contents and tries again.

TODO: Splitting and coalescing should be implemented if ParentAllocator does not defined deallocate.

struct FreeTree(ParentAllocator)
void[]
allocate
(
size_t n
)

Meta