On 9/4/05, Patrick Stinson <[EMAIL PROTECTED]> wrote:
deleting QObject/QWidget objects has never been easy. But, why is it
that the amount of memory used by the following code is not stable?

for i in range(10000000000):
     o = QObject()
print 'done'


the process memory steadily rises to 700M+, then the app dies.


Because you're creating a python list of 10,000,000,000 elements before even involving Qt. Try using xrange() instead of range(). If you do so, you'll notice that the memory consumption is rather stable.

On my machine, creating 10 million QObjects took roughly 30 seconds. You're trying to create 1000 times as many, so unless you've got an extremely fast machine, I'd suggest lowering that number if you ever want to see the output from that print statement :)

--
Mikael Schönenberg
_______________________________________________
PyKDE mailing list    [email protected]
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde

Reply via email to