[Qt-interest] Possible leak in QImage

Nitin Mahajan nitinm76 at yahoo.com
Wed Mar 18 14:18:42 CET 2009


Hello All, 

I was browsing some google images from the demo browser and noticed that the memory consumption is increasing at a fast rate with just one or two imag search operations.

I used valgrind's memcheck and found the following output worth noting.

 ==12945== 30,100,444 bytes in 134 blocks are still reachable in loss record 524 of 524
22917 ==12945==    at 0x4022AB8: malloc (vg_replace_malloc.c:207)
22918 ==12945==    by 0x50FA0F0: QImageData::create(QSize const&, QImage::Format, int) (qimage.cpp:247)
22919 ==12945==    by 0x50FBC25: QImage::QImage(int, int, QImage::Format) (qimage.cpp:835)
22920 ==12945==    by 0x50FD1C4: QImage::convertToFormat(QImage::Format, QFlags<Qt::ImageConversionFlag>) const (qimage.cpp:3      390)
22921 ==12945==    by 0x5126A75: QRasterPixmapData::fromImage(QImage const&, QFlags<Qt::ImageConversionFlag>) (qpixmap_raster      .cpp:148)
22922 ==12945==    by 0x51195EF: QPixmap::fromImage(QImage const&, QFlags<Qt::ImageConversionFlag>) (qpixmap.cpp:1958)
22923 ==12945==    by 0x511A938: QPixmap::load(QString const&, char const*, QFlags<Qt::ImageConversionFlag>) (qpixmap.cpp:808      )
22924 ==12945==    by 0x511ABE5: QPixmap::QPixmap(QString const&, char const*, QFlags<Qt::ImageConversionFlag>) (qpixmap.cpp:


By putting some qDebug() statements in constructors and distructors of QImage and QImageData, I could notice that the some times the QImageData inside a QImage is not deleted, because the reference is not zero.I know t hat the QImages are being cached also, but still as memcheck suggests that there was never an attempt made to free this particular memory and it justs bloats.

Has anyone observed this, any comments? I am using Qt 4.5 for embedded Linux.

regards

-Nitin


      New Email names for you! 
Get the Email name you&#39;ve always wanted on the new @ymail and @rocketmail. 
Hurry before someone else does!
http://mail.promotions.yahoo.com/newdomains/aa/




More information about the Qt-interest-old mailing list