tuples allocated by formated print ?
Alexander Hoffmann
alexander.hoffmann at netgenius.de
Wed Sep 8 05:40:26 EDT 2004
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
More information about the Python-list
mailing list