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
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