Results 1 to 5 of 5

Thread: loading huge pixmaps in slideshow eats up memory despite deleting

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Apr 2011
    Posts
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default loading huge pixmaps in slideshow eats up memory despite deleting

    hi, i'm pretty new to qt, so please be kind to my mistakes ;-)

    my goal is to have a slideshow with crossfading and zoom options. (it's stereoscopic, 3D, so there are two images next to each other)
    that means, there are 4 images involved at the same time at the max.
    i load the images in their original size to be able to zoom in really far. the images have a resolution of approx. 3600 x 2700px (i.e. about 16mb uncompressed).

    i'm displaying the images as QPixmaps inside a qGraphicsScene inside a qGraphicsView to provide the zooming feature (two, to be exact).
    now each time an image loads (which is done inside threads to ensure smooth zooming an fading) memory jumps up in the taskmanager, but doesn't go down again, looks like a stair, the application slows down, ...

    i'm adding each newly loaded image with addPixmap to the QGraphicsScene, and it always says it just holds two objects. i'm deleteing the QPixmap before loading a new one, i'm deleting the threads before starting new ones to load the next images, nothing seems to help.

    the version i had before where i used a QPainter, setOpacity and drawPixmap to display the resized and fading images worked, but it was too slow for 25 fps @ 2 x 1980 x1200, so i came up with the new solution.

    anybody any clues?

    thank you in advance,

    oliver

  2. #2
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: loading huge pixmaps in slideshow eats up memory despite deleting

    Can't really say much without seeing your code, but why delete everything for every picture? Why not use one of each object and just manipulate to suit? Eg. use one thread and send it a signal when you want to load another image, use one (or maybe 2, max) QPixmap, etc.

  3. #3
    Join Date
    Apr 2010
    Posts
    769
    Thanks
    1
    Thanked 94 Times in 86 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: loading huge pixmaps in slideshow eats up memory despite deleting

    On Linux, I'd recommend running the program through valgrind to determine whether there's really a memory leak or not.

    It may be that there isn't. Some unices, for instance, will keep allocating memory under conditions like this until the per-process limit is reached, and only then will they release some. They make no attempt to reuse freed blocks. Not sure what Windows does, but it's probably something similar.

  4. #4
    Join Date
    Apr 2011
    Posts
    124
    Thanks
    1
    Thanked 10 Times in 10 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows Symbian S60

    Default Re: loading huge pixmaps in slideshow eats up memory despite deleting


Similar Threads

  1. Loading Qt resource file on to Shared Memory Windows CE 5.0
    By thanuj in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 23rd December 2010, 12:34
  2. Displaying pixmaps and memory leak ??
    By tonytony in forum Qt Programming
    Replies: 7
    Last Post: 29th June 2010, 13:12
  3. Loading and saving in-memory SQLITE databases
    By miraks in forum Qt Programming
    Replies: 10
    Last Post: 27th April 2010, 21:24
  4. Loading an image into memory
    By Luc4 in forum Qt Programming
    Replies: 6
    Last Post: 12th April 2010, 08:44
  5. creating/deleting Objects // memory leaks
    By janus in forum Qt Programming
    Replies: 4
    Last Post: 27th March 2008, 18:17

Tags for this Thread

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.