Next Prev Up Top Contents Index

set-array-weak

Function
Summary

Sets the weakness state of an array.

Package

hcl

Signature

set-array-weak array weakp => weakp

Arguments

array

A non-displaced array, with array-element-type t .

weakp

If weakp is non- nil , the array is made weak. If weakp is nil , the array is made non-weak.

Values

Returns weakp .

Description

By default, arrays are non-weak, and keep alive all the objects that are stored in them. A weak array may remove a pointer if the object that it points to is not pointed to from somewhere else. When a pointer is removed like this, it is replaced in array with nil .

Pointers are replaced by nil after a garbage collector operation that identifies that they can be replaced. This means that if the object that is pointed to has been promoted to a higher generation, a garbage collection (mark and sweep) of the higher generation is required to remove the pointer. Note that by default the system does not automatically call mark-and-sweep on generation 2 or higher.

The weakness state of an array can be changed many times.

array must not be a displaced array. The array-element-type of array must be t .

set-array-weak can be called at any moment.

See also
set-hash-table-weak
mark-and-sweep

LispWorks Reference Manual - 13 Jun 2003

Next Prev Up Top Contents Index