Possible memory leak?
Stephen Kellett
snail at objmedia.demon.co.uk
Tue Jan 24 19:22:27 EST 2006
In message <pan.2006.01.24.22.11.01.271987 at REMOVETHIScyber.com.au>,
Steven D'Aprano <steve at REMOVETHIScyber.com.au> writes
>But the real killer is this one line:
>
>row=row+chr(num/64)
>
>Bad, bad BAD idea. Every time you add two strings together, Python has to
>copy BOTH strings. As row gets huge, this takes longer and longer to do.
>
>A rule of thumb I use is, never add more than two strings together. Maybe
>three. Certainly not more than four. Or five.
>
>But absolutely not millions of strings, which is what you are doing.
You would be able to visualize this process very well using Python
Memory Validator and Python Performance Validator.
http://www.softwareverify.com
Stephen
--
Stephen Kellett
Object Media Limited http://www.objmedia.demon.co.uk/software.html
Computer Consultancy, Software Development
Windows C++, Java, Assembler, Performance Analysis, Troubleshooting
More information about the Python-list
mailing list