The Heap

The heap is a linked list of heap blocks. The size of the largest object the collector can allocate is limited by the size of the heap block. Internally each heapblock is made up of pages. Pages and heap blocks must be a power of 2 words in size. Heap blocks are aligned on heap block size boundaries, and consequently pages are also aligned on page size boundaries. The only data structure maintained outside the heap block is gcInfo. gcInfo serves as the data strcuture for all garbage collection statistics, and pointers to internal data structures which are also contained in the heap blocks.

PageInfo structures are maintained for each page within each heap block. These are located immediately following the start of a heap block so that given a pointer within the block its page and PageInfo structure can be easily found.

The following table illustrates some fairly typical numbers for these quantities.
Data StructureSizeComments
Word 32 Bit Also intend to support 64 Bit words in the future.
Page 29 Words 512 Words
PageInfo 18 Words See the link for an explanation of the size.
HeapBlock 220 Words 4 MegaBytes
211 Pages 220 Words/(29 Words/Page)
Maximum Heap 232 Words 4 GigaBytes
223 Pages 232 Words/(29 Words/Page)