Results 1 to 8 of 8

Thread: My QPixmaps objects are null over a specific range of created objects ... why ?

  1. #1
    Join Date
    Jan 2006
    Posts
    162
    Thanks
    9
    Qt products
    Qt3
    Platforms
    Windows

    Default My QPixmaps objects are null over a specific range of created objects ... why ?

    Hi everybody,

    I'm trying to fill a QCanvasPixmapArray with QCanvasPixmap but over a specific number of objets created (191 in ly case) the QCanvasPixmap are always null. I don't know why and it is blocking for me.

    Here is my code :
    Qt Code:
    1. for(int i =0; i<71; i++)
    2. {
    3. static QString fn;
    4. fn = path + QString::number(i) + ".png";
    5.  
    6. QCanvasPixmap* pCanPix = new QCanvasPixmap(fn);
    7. Q_ASSERT( pCanPix );
    8. if( pCanPix->isNull() )
    9. qDebug("%s is null", fn);
    10. fullpixes->setImage(i, pCanPix);
    11. }
    To copy to clipboard, switch view to plain text mode 

    Each image is 800x480 pixels.

    Is there any limitation with the number of object reference it is possible to use ?

    Thanks in advance

  2. #2
    Join Date
    Apr 2006
    Location
    San Francisco, CA
    Posts
    186
    Thanks
    55
    Thanked 12 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: My QPixmaps objects are null over a specific range of created objects ... why ?

    Can you print out the value of fn to verify the path is correct?
    If that doesn't help, have you tried stepping into the code of the QCanvasPixmap constructor?
    Software Engineer



  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: My QPixmaps objects are null over a specific range of created objects ... why ?

    192 pixmaps with 800x480 pixels each in 24bits of colour give us:

    800x480x3x192 = 221 184 000 bytes = 210MB

    Maybe that's the reason? That you're out of memory somewhere (some OS limitation maybe)?

    BTW. If using 8b alpha channel this increases to 281MB.

  4. #4
    Join Date
    Jan 2006
    Posts
    162
    Thanks
    9
    Qt products
    Qt3
    Platforms
    Windows

    Default Re: My QPixmaps objects are null over a specific range of created objects ... why ?

    gfunk, no need to print fn because it is correct. The first 190 pixmap are loaded and can be displayed the others are null and problematic

    wysota, I thought that the origin of my problem could be a memory overflow due to a limitation (OS or other) but I am not able to be sure, so I must find a solution to my problem. I can't change the pixmaps and keep them encoded in 24 bit.

    Thanks for your help.

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: My QPixmaps objects are null over a specific range of created objects ... why ?

    Maybe you don't need >190 pixmaps loaded into memory all the time?

  6. #6
    Join Date
    Jan 2006
    Posts
    162
    Thanks
    9
    Qt products
    Qt3
    Platforms
    Windows

    Default Re: My QPixmaps objects are null over a specific range of created objects ... why ?

    That's true Wysota. I can load the big pixmaps in memory (those whose definition is 800x480) and the others can be loaded during on the fly.

    I have another informations to give about my problem, I have 1Go of RAM (OS Windows NT, VisualC++ 6.0, QT3.3.3.) and when I look at the performance in the task manager, the memory seems not to be full. Maybe the limitation does not concern the memory but the number of pixmap handled ? It will surprise me because I'm using canvas and the documentation tell that it can manage many and many objects at a time.

    I'm trying to find out some similar information over internet ... I am alone for the moment with this problem and until I find the cause of my bug I can't progress.

    I'll be happy If you have some more information or if you can reproduce the problem

  7. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: My QPixmaps objects are null over a specific range of created objects ... why ?

    Quote Originally Posted by yellowmat
    That's true Wysota. I can load the big pixmaps in memory (those whose definition is 800x480) and the others can be loaded during on the fly.
    Or you can keep the small ones in memory and load the big ones on demand

    I have another informations to give about my problem, I have 1Go of RAM (OS Windows NT, VisualC++ 6.0, QT3.3.3.) and when I look at the performance in the task manager, the memory seems not to be full.
    That doesn't mean anything. The limitation may sit somewhere in Qt or in the underlying OS (for example in its GUI module).

    Maybe the limitation does not concern the memory but the number of pixmap handled ? It will surprise me because I'm using canvas and the documentation tell that it can manage many and many objects at a time.
    Objects -- yes, but they don't have to all consist of huge pixmaps, right?

    I'm trying to find out some similar information over internet ... I am alone for the moment with this problem and until I find the cause of my bug I can't progress.
    I'd subclass QCanvasSprite and make it load the data dynamically. Do you really need more than 190 frames of animation?

  8. #8
    Join Date
    Jan 2006
    Posts
    162
    Thanks
    9
    Qt products
    Qt3
    Platforms
    Windows

    Default Re: My QPixmaps objects are null over a specific range of created objects ... why ?

    I need to keep the big pixmaps in memory because some of them (about 10 pixmaps) they must be displayed every 50 ms. The smallest pixmaps need not to be displayed as fast.

    My animation is based on about 140 pixmaps and represents a menu, some of the pixmaps are used to play an animation to set the current item in focus and the others to pass the focus from an item to another.

    I found some information about my problem, here are two links if you want to take a look.


    http://lists.trolltech.com/qt-intere...ad00014-0.html
    http://lists.trolltech.com/qt-intere...ad00395-0.html

    It is said that the use of QPixmap could lead to OS limitation and instead it is better to use QImage ... so I'll check my code and try to change QPixmap with QImage. As I use Windows OS ... QPixmap is coupled to the HBITMAP limitation.

    I need to investigate some more ... and will keep here a trace of my results.

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.