NextPrevUpTopContentsIndex

make-array

Function
Summary

Creates and returns a new array which, in addition to the standard functionality, can be a weak array or statically allocated.

Package

common-lisp

Signature

make-array dimensions &key element-type initial-element initial-contents adjustable fill-pointer displaced-to displaced-index-offset weak allocation => new-array

Arguments

weak

A generalized boolean.

allocation

A fixnum, or one of nil , :new , :static , :old , or :long-lived .

Description

The standard definition of make-array is extended to accept the keyword arguments :weak and :allocation .

If weak is non- nil , then displaced-to must be nil and if element-type is supplied it must have upgraded-array-element-type t , otherwise an error is signalled. That is, you cannot make a weak array which is displaced or has array-element-type other than t . When weak is non- nil , it makes new-array weak.

If weak is nil , then make-array behaves in the standard way, and new-array is not weak. The value weak defaults to nil .

See set-array-weak for a description of weak arrays.

The possible values for allocation have the following meanings:

:new

Allocate the array normally.

nil

Same meaning as :new . This is the default value.

:static

Allocate the array in a static segment.

:long-lived

Allocate the array assuming it is going to be long-lived.

:old

Same meaning as :long-lived

A fixnum n

Allocate the array in generation n .

Arrays (including strings) that are passed by address to foreign functions must be static, and so must should be created with :allocation :static .

Allocation with :old or :long-lived is useful when you know that the array will be long-lived, because your program will avoid the overhead of promoting it to the older generations.

See also

set-array-weak


LispWorks Reference Manual - 12 Mar 2008

NextPrevUpTopContentsIndex