Message397287
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 |
|
Date |
User |
Action |
Args |
2021-07-12 07:00:30 | Stardust1225 | set | recipients:
+ Stardust1225 |
2021-07-12 07:00:30 | Stardust1225 | set | messageid: <1626073230.86.0.981576965453.issue44608@roundup.psfhosted.org> |
2021-07-12 07:00:30 | Stardust1225 | link | issue44608 messages |
2021-07-12 07:00:30 | Stardust1225 | create | |
|