Previous: , Up: Object Format   [Contents]


40.17 Weak Pointers

A weak-pointer data-block has the following format:

-------------------------------------------------------
|  4 (data-block words) |  Weak pointer Type (8 bits) |
-------------------------------------------------------
|                 weak-pointer-value                  |
-------------------------------------------------------
|                 weak-pointer-broken                 |
-------------------------------------------------------
|                 mark-bit (T or NIL)                 |
-------------------------------------------------------
|                   next                              |
-------------------------------------------------------

The mark-bit is used when gencgc is available. It’s used to note if this weak pointer has been visited before so that scavenging weak-pointers isn’t an $O(n^2)$ process.

The last slot is an internal slot used by the C runtime to chain all the weak pointers together for GC.