Mark Shannon wrote: > With a tracing GC: > While the Elements are finalized, the Document is still alive. > While the Document is finalized, the Elements are still alive. > Then, and only then, is the whole lot reclaimed. One problem is that, at the C level in CPython, you can't separate finalisation and reclamation. When an object's refcount drops to zero, its tp_dealloc method is called, which both finalises the object and reclaims its memory. Another problem is that just because an object's memory hasn't been reclaimed yet doesn't mean it's safe to do anything with that object. This is doubly true at the C level, where the consequences can include segfaults. Seems to me the basic issue here is that the C code wasn't designed with tracing GC in mind. There is a reference cycle, but it is assumed that the user is in manual control of deallocation and will deallocate the Nodes before the Document. -- Greg
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4