Serhiy Storchaka <storchaka+cpyt...@gmail.com> added the comment:

indent=True just makes json to use Python implementation instead of C 
implementation. Python implementation uses closures which reference one other. 
Simple example not involving json is:

import gc

def f():
    def g():
        return h
    def h():
        return g
    return

gc.set_debug(gc.DEBUG_LEAK)
while True:
    f()
    gc.collect()
    print(f"garbage count: {len(gc.garbage)}")


The "leak" is caused by using gc.set_debug(gc.DEBUG_LEAK). gc.DEBUG_LEAK 
includes gc.DEBUG_COLLECTABLE, gc.DEBUG_UNCOLLECTABLE and gc.DEBUG_SAVEALL. 
gc.DEBUG_SAVEALL causes garbage-collected objects to be saved in gc.garbage for 
inspection. In normal circumstances they are collected.

----------
nosy: +pitrou, serhiy.storchaka

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32045>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to