All Manuals > LispWorks® User Guide and Reference Manual > 28 Miscellaneous Utilities

28.1 Object addresses and memory

In general, you cannot rely on the addresses of Lisp objects, because the Garbage Collector moves objects. The functions described in this section are intended for debugging only.

You can find the current address of a Lisp object as an integer by object-address. You can get the pointer of an object (current address plus any tagging) by object-pointer. This is what is normally used when printing objects unreadably. You can find which object is currently at some address by using pointer-from-address.

You can find the size of a heap object by using find-object-size. However, many Lisp objects are made of multiple heap objects, and typically the "root" heap object (the one that the Lisp pointer points to) is relatively small, so for these objects find-object-size returns a meaningless value. It is actually useful only for vectors that are simple (not with fill pointer or adjustable or displaced) and structures. It also gives meaningful values for integers, floats and conses.

LispWorks® User Guide and Reference Manual - 01 Dec 2021 19:30:25