Function | Package: system | ToC | DocOverview | CGDoc | RelNotes | FAQ | Index | PermutedIndex
| Allegro CL version 10.1 Object described on page has changed in 10.1. 10.0 version

## lispval-storage-type

Arguments: object &optional type

Returns information about storage classifications or of the storage-classification of an object.

If type is not given, then the object's storage attributes are examined, and the most specific description of these attributes is returned in the form of a keyword. The possible keywords are:

1. `:immediate`, which means the object is not referenced with a pointer (fixnums, e.g.)
2. `:static`, which means the object is stored in an area which is not garbage collected.
3. `:tenured`, which means the object is stored in oldspace (also called tenured space).
4. `:new`, which means the object is stored in newspace but will, if it survives, eventually be tenured.
5. `:panified`, which means that the object is stored in newspace and will never be tenured. (The name comes from Peter Pan, who never grew old.) See the note just below.
6. `:weak`, which means the object is in newspace, will not be tenured, and is a weak vector.
7. `:finalized`, which means that the object is a finalization.
8. `:weak-key-non-panified`, which means that the object is a weak-key vector in newspace, but may be tenured (after which it will no longer be weak).
9. `:weak-key-panified`, which means that the object is a weak-key vector in newspace which will not be tenured.
10. `:stack-allocated`, which means the object resides on a stack somewhere. Note that on a non-os-threads Lisp the value may be seen as `:stack-allocated` even if it is outside of the stack it resides and should have been called `:static`. An object for which lispval-storage-type returns `:stack-allocated` will still cause sys:pointer-storage-type to return `:static` when passed as an argument to it.
11. `:pure`, which means the object is in the pll (pure-lisp-library) space, and is thus read-only/shared. A `:pure` object will still cause sys:pointer-storage-type to return `:static` when passed as an argument to it. See pll-file (and links from there) and also Getting information on memory management using cl:room in gc.htm for more information on pure space.

Note on :panified objects: Only system-created objects can have storage type `:panified` but sometimes these objects are created as a consequnce of user action. The key vector of a weak-keys hashtable is typically a `:panified` object, though this can be controlled. See cl:make-hash-table in implementation.htm.

type can be `:all` or one of the storage types keywords in the list above.

If type is `:all`, a list of possible storage types is returned (and the object argument is ignored). Thus, when type is `:all`, the call is for information about the current implementation of lispval-storage-type, which may be modified in a patch subsequent to the release.

If type is a storage type, lispval-storage-type returns true or `nil` as the storage type of object matches or does not match type. Here match means `is of that storage type', not `is eq to the value returned by lispval-storage-type when type is not specified'. If lispval-storage-type returns `:weak` when type is not specified, it will return true when type is `:weak` and when type is `:new`.

See gc.htm for a discussion of where Lisp objects are stored. lispval-storage-type replaces the now deprecated pointer-storage-type.

### Example

    ;; A 1-d static array has storage type :STATIC
    ;; (2-d and higher dimension
    ;; static arrays have headers that are Lisp objects so they will have
    ;; storage type :NEW or :TENURED, but their data vectors
    ;; (available via INSPECT)
    ;; will have storage type :STATIC):
    CL-USER(24): (sys:lispval-storage-type
                   (make-array 3 :allocation :static
                               :element-type 'fixnum :initial-element 2))
    :STATIC
    ;; Fixnums are immediates:
    CL-USER(25): (sys:lispval-storage-type 22)
    :IMMEDIATE
    ;; Most Lisp objects start in new space:
    CL-USER(26): (setq a (cons 1 2))
    (1 . 2)
    CL-USER(27): (sys:lispval-storage-type a)
    :NEW
    ;; And after surviving several scavenges, they typically
    ;; move to oldspace:
    CL-USER(28): (gc) (gc) (gc) (gc) (gc)
    CL-USER(29): (sys:lispval-storage-type a)
    :TENURED

    ;;  Here we show the use of the TYPE argument:
    CL-USER(30): (setq a (make-array 10 :weak t))
    #(NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL)
    CL-USER(31): (sys:lispval-storage-type a)
    :WEAK
    CL-USER(32): (sys:lispval-storage-type a :new)
    T
    CL-USER(5): (sys:lispval-storage-type a :weak)
    T
    CL-USER(6):

Copyright (c) 1998-2022, Franz Inc. Lafayette, CA., USA. All rights reserved.
The object described on this page has been modified in the 10.1 release; see the Release Notes.
Created 2019.8.20.

|  | ToC | DocOverview | CGDoc | RelNotes | FAQ | Index | PermutedIndex
| Allegro CL version 10.1 Object described on page has changed in 10.1. 10.0 version