Next: , Previous: The garbage collector, Up: Memory management


4.4 Allocation Functions

The following functions are used to set or inspect the (maximum) number of pages for each type class, for contiguous blocks, or for relocatable blocks.

— extensions: allocate type number

Sets the maximum number of pages for the type class of the implementation type type to number. If more than number pages have already been allocated, an error is signalled.

— sys: allocated-pages type

Returns the number of pages currently allocated for the type class of the implementation type type.

— sys: maximum-allocatable-pages type

Returns the current maximum number of pages for type class of the implementation type type.

— sys: allocate-contiguous-pages number

Sets the maximum number of pages for contiguous blocks to number.

— sys: allocated-contiguous-pages

Returns the number of pages allocated for contiguous blocks.

— sys: maximum-contiguous-pages

Returns the current maximum number of pages for contiguous blocks.

— sys: allocate-relocatable-pages number

Sets the maximum number of pages for relocatable blocks to number. The relocatable area is expanded to number pages immediately. Therefore,“the current maximum number” and “the number of pages allocated” have the same meanings for relocatable blocks.

— sys: allocated-relocatable-pages

Returns the number of pages allocated for relocatable blocks.

If the pages for a particular type class are exhausted after the maximum number of pages for that class have been allocated, and if there remain no free cells (actually, if there remain very few cells), ECL behaves as directed by the argument that was initially passed to the ECL specific function (si::ignore-maximum-pages). If the value is (), then ECL signals a correctable error and enters the break loop. The user can reset the maximum number by calling allocate and then continue the execution of the program by typing :r.

Example:

>(make-list 100000)

Correctable error: The storage for CONS is exhausted.
                   Currently, 531 pages are allocated.
                   Use ALLOCATE to expand the space.
Signalled by MAKE-LIST.

Broken at FUNCALL.
>>(ALLOCATE 'CONS 1000)
t

>>:r

(nil nil nil nil nil nil nil nil nil nil ............

The user can also reset the maximum number of pages for relocatable blocks and for contiguous blocks in a similar manner. On the other hand, if the value of (si::ignore-maximum-pages) is non-(), then ECL automatically increments the maximum number of pages for the class by 50 percent. The initial value of (si::ignore-maximum-pages) is T.