8000 Add a warning section regarding tagged pointers · python/devguide@6c02402 · GitHub
[go: up one dir, main page]

Skip to content

Commit 6c02402

Browse files
committed
Add a warning section regarding tagged pointers
1 parent 7c8e02a commit 6c02402

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

garbage_collector.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,15 @@ word-aligned addresses end in ``000``, leaving the last 3 bits available.
400400

401401
The CPython GC makes use of two fat pointers:
402402

403+
.. warning::
404+
405+
Because the presence of extra information, "tagged" or "fat" pointers cannot be
406+
dereferenced directly and the extra information must be stripped off before to
407+
obtain the real memory address. Special care needs to be taken with functions that
408+
directly manipulate the linked lists, as these functions normally asume the
409+
pointers in the linked lists are in a consistent state.
410+
411+
403412
* The ``_gc_prev``` field is normally used as the "previous" pointer to maintain the
404413
doubly linked list but its lowest two bits are used to keep the flags
405414
``PREV_MASK_COLLECTING`` and ``_PyGC_PREV_MASK_FINALIZED``. Between collections,

0 commit comments

Comments
 (0)
0