New submission from Brandt Bucher <brandtbuc...@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 <rep...@bugs.python.org>
<https://bugs.python.org/issue41984>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to