New submission from stardust222 <490661...@qq.com>:
In the following code, the memory use of function _tkinter._flatten is increase as the number of calls when I input an illegal value. import sys import tracemalloc import _tkinter arg_list = [] arg_list.append('ptqiioaaejhdoat') # check for memory usage memory_recorder = [] tracemalloc.start() start_snapshot = tracemalloc.take_snapshot() for i in range(0, 100): try: _tkinter._flatten(arg_list[0]) except: pass if i % 10 == 0: one_snapshot = tracemalloc.take_snapshot() memory_recorder.append(one_snapshot.compare_to(start_snapshot, 'lineno')[0]) for i in range(2, len(memory_recorder)): if str(memory_recorder[i].traceback) == str(memory_recorder[1].traceback): print(memory_recorder[i].traceback) print(memory_recorder[i].size) tracemalloc.stop() And the output on my machine is test.py:19 3248 test.py:19 4800 test.py:19 6448 test.py:19 8000 test.py:19 9648 test.py:19 11248 test.py:19 12848 test.py:19 14400 ---------- components: C API messages: 397287 nosy: Stardust1225 priority: normal severity: normal status: open title: Memory use increase in function _tkinter._flatten type: resource usage versions: Python 3.9 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue44608> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com