[issue41984] Empty __slots__ can create untracked reference cycles
Brandt Bucher
report at bugs.python.org
Fri Oct 9 15:17:48 EDT 2020
New submission from Brandt Bucher <brandtbucher at gmail.com>:
Currently, we don't track instances of certain heap types based on the assumption that "no members" == "no reference cycles".
Unfortunately, it's still possible to create untracked reference cycles with one's parents. The following program leaks memory:
while True:
class C:
__slots__ = ()
C.i = C()
del C
The fix is simple: track all instances of user-defined classes, no exceptions. I'm not sure we were actually getting any real wins from the old behavior anyways.
----------
assignee: brandtbucher
components: Interpreter Core
messages: 378337
nosy: brandtbucher, pablogsal
priority: low
severity: normal
status: open
title: Empty __slots__ can create untracked reference cycles
type: resource usage
versions: Python 3.10, Python 3.8, Python 3.9
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue41984>
_______________________________________
More information about the Python-bugs-list
mailing list