This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Stardust1225
Recipients Stardust1225
Date 2021-07-12.07:00:30
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1626073230.86.0.981576965453.issue44608@roundup.psfhosted.org>
In-reply-to
Content
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
History
Date User Action Args
2021-07-12 07:00:30Stardust1225setrecipients: + Stardust1225
2021-07-12 07:00:30Stardust1225setmessageid: <1626073230.86.0.981576965453.issue44608@roundup.psfhosted.org>
2021-07-12 07:00:30Stardust1225linkissue44608 messages
2021-07-12 07:00:30Stardust1225create