tuples allocated by formated print ?

  • Thread starter Alexander Hoffmann
  • Start date
A

Alexander Hoffmann

Hello,

Recently I was debugging a memory leak in my app and finally figured out that
I had to manually implement destructors for some classes.
While debugging I wrote a method that prints the number of instances per type
for all objects returned by gc.get_objects. I was astonished by the fact that
after perfroming a few tests with my app there were about 4000 instances of
Tuple in memory. Looking at these instances I got the feeling that they
contained the values I used in formated prints like: print ("my name is %s" %
("alex", ))
Can anyone of you confirm that tuples constructed this way will be removed
from memory by Python automatically ?
If so, can you imagine any reason for so many tuple instances to exist (given
the fact that besides in print (...) I do not make use of tuples in my source
code) ?


Thank you !
Alex
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top