Next: The garbage collector, Previous: Implementation types, Up: Memory management
The memory space of ECL is divided into two parts: the heap area and the relocatable area. Both areas occupy a contiguous space in the memory.
Cells of ECL objects are allocated in the heap. ECL divides the heap into pages (1 page = 2048 bytes), and each page consists of cells in the same type class (see Table 4-2). Cells in different type classes are allocated in different pages. Some blocks are also allocated in the heap: They are called contiguous blocks. The pages for contiguous blocks contain only contiguous blocks. Thus each page in the heap is either a page for cells in a particular type class, or a page for contiguous blocks. Blocks not in the heap are called relocatable blocks and are allocated in the relocatable area.
The user may specify the maximum number of pages that can be allocated for each
type class by calling the ECL specific function allocate
. There is
also a limit on the number of pages for contiguous blocks; the limit can be
altered by calling the ECL specific function
allocate-contiguous-pages
size of the relocatable area is specified by
the ECL specific function allocate-relocatable-pages
. See Section
4.4 for these functions.
In some installations of ECL, the total amount of memory that ECL can use is limited. In such cases, the entire memory may become exhausted before the maximum number of pages for each type class, for contiguous blocks, or for the relocatable area have been allocated.
The heap lies in a part of memory with lower address than the relocatable area and there is a “hole” between the two areas (see Figure 4-1). On request for a new page of heap, the page with the lowest address in the hole is used. When the hole is exhausted, the relocatable area is shifted toward the higher address space and a new hole of an appropriate size is created between the two areas.
Lower address Higher address +--------------+-------------------+---------------+ + HEAP | HOLE | RELOCATABLE | +--------------+-------------------+---------------+