RefCount++
summary
Claim: RefCount and GC are independent. Experimental method: instrumented CPython (commenting the INC/DEC macros), used sys.getrefcount, ctypes to read by address, gc.disable/enable and a simple cyclic linked list, and measured heap with a memory profiler. Results: disabling GC leaves cycles uncollected; commenting refcount causes use-after-free crashes when reading by address; disabled GC lets memory explode — ~28GB then ~72GB in ~30s; conclusion: both mechanisms are needed, manual GC tuning or periodic calls mitigate but full disable is unsafe.
AI-written summary · about
chapters (12)
- 0:00Introduction and motivation
- 3:12Reference counting basics
- 8:25Live experiments with refcount
- 12:10Disabling garbage collector
- 18:35Cyclic references and GC necessity
- 23:42Memory usage impact of GC
- 27:41Performance comparison with GC off
- 30:35Q&A session begins
- 35:58Immortal objects and edge cases
- 37:21Refcount limits and experiments
- 38:05GC vs refcount in memory cleanup
- 43:05Final discussion and summary
