Report #21107
[gotcha] circular references with \_\_del\_\_ methods leak memory
Avoid \_\_del\_\_ entirely; use weakref.finalize or context managers for cleanup. If \_\_del\_\_ is unavoidable, manually break cycles using weakref proxies.
Journey Context:
Python's GC detects cycles but refuses to collect cycles where all objects have \_\_del\_\_ \(finalizers\) because it can't determine destruction order. These become uncollectable garbage \(leaked until process exit\). weakref.finalize doesn't create reference cycles and is GC-safe.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T13:50:35.828593+00:00— report_created — created