[Qt-interest] pls

Arnold Krille arnold at arnoldarts.de
Thu Apr 1 00:05:08 CEST 2010


On Wednesday 31 March 2010 23:42:57 Mukesh Gopalakrishnan wrote:
> > > My QT program hangs if I run for one or two week because there is
> > > memory leaks!!!!! BUT I can free the memory 98% it is wunderfulll! Here
> > > is how it works
> > My Qt-apps run for two weeks without leaking memory. And I allocate and
> > release memory around 2000 times a second...
> You are very wrong!

Cool, now you want to tell me that my apps are crashing because of limited 
memory while in practice they run for more then 2 weeks 24/7 with "only" 3GB 
of ram (and no swap) available allocating and releasing memory like crazy?

I know that sentence is a bit long (its almost midnight here), but please try 
to understand what I said and what you seem to tell me:
My apps run for very long times on disk-less (and head-less) machines. They 
allocate memory block of around 4kB around 10.000 times per _second_ and 
release that memory in one thread around 8.000 times per _second_ and in 
another thread around 2000 times a _second_. That is it keeps buffers.
Still when the app stops data-evaluation without quitting the app, memory 
usage of the app is down to 0.3%.
I did a lot of testing with "valgrind --tool=memcheck" to find memory leaks in 
my code. (With that many allocations per second you can't afford even one 
single byte leaking.) The only "leaks" found are leaks of a) static objects in 
Qt or libs used in Qt or b) very small leaks in X- or font-libraries created 
only a hand-full of times.

Every year or so someone claims that one can "free" memory by allocating a lot 
and releasing it. Yes, that has a memory-freeing effect. Because it clears the 
memory from the cache the kernel keeps of files. But this cache is good for 
you. It helps access these files faster and is actually freed as soon as an app 
needs that memory.

If your app gets slow after long run-times because of memory usage, its 
because it uses to much ram and the system has to swap.
Please run _your_ app in a memory-checker like "valgrind --tool=memcheck", 
look carefully at the output and fix the memory leaks found inside the code you 
wrote.

I repeat: I can assure you that the Qt-libraries are _not_ leaking memory 
anywhere near the memory figures that make your app _big_ after weeks of 
runtime.

Have fun,

Arnold

PS: Contact me in private for my rates if you need a memory-leak-check done on 
your software and are not capable of doing it yourself.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100401/d41f3624/attachment.bin 


More information about the Qt-interest-old mailing list