Results 1 to 12 of 12

Thread: QPixmaps don't seem to deallocate from memory(solved)

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QPixmaps don't seem to deallocate from memory

    Without keyword "new":
    Qt Code:
    1. QList<QPixmap> thumbnails;
    2. ...
    3. // qDeleteAll(thumbnails); // remove this
    4. thumbnails.clear();
    5. ...
    6. QPixmap image = QPixmap(database->cell(currentRows.at(row), "thumbnail" + thumbnailSize));
    7. thumbnails += image;
    To copy to clipboard, switch view to plain text mode 
    J-P Nurmi

  2. The following user says thank you to jpn for this useful post:

    timothy.crosley (14th August 2007)

  3. #2
    Join Date
    Aug 2007
    Posts
    5
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QPixmaps don't seem to deallocate from memory

    I should have known what you meant . Sadly this still doesn't fix the memory leak(I actually had it this way originally). I have been trying to fix this bug for 3 days now and its driving me insane .
    ~Timothy

  4. #3
    Join Date
    Oct 2006
    Posts
    279
    Thanks
    6
    Thanked 40 Times in 39 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QPixmaps don't seem to deallocate from memory

    Since you mentioned the QPixmapCache, what does QPixmapCache::cacheLimit () return.

  5. The following user says thank you to spud for this useful post:

    timothy.crosley (14th August 2007)

  6. #4
    Join Date
    Aug 2007
    Posts
    5
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QPixmaps don't seem to deallocate from memory

    It returns 1024.

  7. #5
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QPixmaps don't seem to deallocate from memory

    If you have the possibility, step in the QPixmap destructor and see if it deletes the data member.
    Qt Code:
    1. [B]void QPixmap::deref()
    2. {
    3. if(data && data->deref()) { // Destroy image if last ref
    4. if (qt_pixmap_cleanup_hook_64)
    5. qt_pixmap_cleanup_hook_64(cacheKey());
    6. delete data;
    7. data = 0;
    8. }
    9. }[/B]
    To copy to clipboard, switch view to plain text mode 


    Regards

  8. The following user says thank you to marcel for this useful post:

    timothy.crosley (14th August 2007)

  9. #6
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QPixmaps don't seem to deallocate from memory(solved)

    What was the problem and how was it solved in the end?

    Edit: Oh, sorry. I didn't notice the first post being modified..
    Last edited by jpn; 15th August 2007 at 22:05.
    J-P Nurmi

  10. #7
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QPixmaps don't seem to deallocate from memory(solved)

    Quote Originally Posted by jpn View Post
    What was the problem and how was it solved in the end?
    See the first post .

Similar Threads

  1. Memory Leak in my Application :-(
    By Svaths in forum Qt Programming
    Replies: 4
    Last Post: 27th July 2007, 19:42

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.