473,404 Members | 2,174 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

tuples allocated by formated print ?

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
Jul 18 '05 #1
0 1239

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: BJörn Lindqvist | last post by:
I like tuples alot. But in some situations you seem to be forced to access the elements of a tuple via its indexes and that is pretty ugly. For example: # make_color() returns a rgb tuple (r, g,...
66
by: Darren Dale | last post by:
Hello, def test(data): i = ? This is the line I have trouble with if i==1: return data else: return data a,b,c,d = test()
44
by: seberino | last post by:
Tuples are defined with regards to parentheses ()'s as everyone knows. This causes confusion for 1 item tuples since (5) can be interpreted as a tuple OR as the number 5 in a mathematical...
13
by: Harlin Seritt | last post by:
I have three tuples of the same size: tup1, tup2, tup3 I'd like to do something like this: for a,b,c in tup1, tup2, tup3: print a print b print c Of course, you get an error when you try...
1
by: Steven D'Aprano | last post by:
I'm trying to understand the use of tuples in function argument lists. I did this: >>> def tester(a, (b,c)): .... print a, b, c .... >>> tester(1, 2) Traceback (most recent call last):...
8
by: nidhog | last post by:
Hello guys, I made a script that extracts strings from a binary file. It works. My next problem is sorting those strings. Output is like: ---- snip ---- 200501221530
7
by: Tuvas | last post by:
Let's say I make a program something like follows: x= x.append() x.append() print x print x print x x=5
27
by: seberino | last post by:
Please help me think of an example where immutable tuples are essential. It seems that everywhere a tuple is used one could just as easily use a list instead. chris
4
by: =?utf-8?B?TWFjaWVqIEJsaXppxYRza2k=?= | last post by:
Hi Pythonistas! I've got a question about storing tuples in a dictionary. First, a small test case which creates a list of dictionaries: import time list_of_dicts = keys = prev_clk =...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.