[New-bugs-announce] [issue32045] Does json.dumps have a memory leak?

Rohan D'Sa report at bugs.python.org
Thu Nov 16 03:20:19 EST 2017


New submission from Rohan D'Sa <roh4n.ds4 at gmail.com>:

import gc, json

class leak(object):
    def __init__(self):
        pass

gc.set_debug(gc.DEBUG_LEAK)
while True:
    leak_ = leak()
    json.dumps(leak_.__dict__, indent=True)
    gc.collect()
    print(f"garbage count: {len(gc.garbage)}")

Using the following code under Python 3.6.3, the garbage count keeps increasing and windows task manager records steady memory increase.

However without indent json.dumps(self.__dict__), no leak is observed.

----------
components: Library (Lib)
messages: 306344
nosy: rohandsa
priority: normal
severity: normal
status: open
title: Does json.dumps have a memory leak?
versions: Python 3.6

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32045>
_______________________________________


More information about the New-bugs-announce mailing list