Results 1 to 9 of 9

Thread: Getting a SIGSEGV error when loading a pixmap

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Nov 2016
    Location
    Ridgecrest California
    Posts
    33
    Thanks
    11
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt5
    Platforms
    Windows Android

    Default Re: Getting a SIGSEGV error when loading a pixmap

    As an addendum to my previous post, I previously had discovered in the Qt documentation, that all pixmaps are placed in a QpixmapCache and the default size for the QpixmapCache is 10240 KB. I wanted to load 2 images with a combined file size of 1846 KB which falls well within the default QPixmapCache size limit. Therefore, one would think that was not the problem. However I have made a smaller version (lower resolution) of the largest file (the one used in the above code) and have found that I no longer receive the SIGSEGV error, and it works as expected. It's not clear to me at this point if the QPixmapCache size limit is the issue or not. Qt provides a way to increase the limit, yet I have yet to find a discussion on the cost of doing so. Unfortunately, I have a requirement for the higher resolution image. In any event, if anyone knows of a discussion or any kind of information that covers this topic, I'd be happy to check it out.
    Thanks again to any who may reply.

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,324
    Thanks
    316
    Thanked 871 Times in 858 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Getting a SIGSEGV error when loading a pixmap

    If I do the math, a 2000 x 2000 pixel image is 4 million pixels. If each pixel is a 32-bit RGBA value, this is 16 MB per image, more than the size of the cache for just one image. They are obviously compressed to a smaller size on disk.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  3. #3
    Join Date
    Nov 2016
    Location
    Ridgecrest California
    Posts
    33
    Thanks
    11
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt5
    Platforms
    Windows Android

    Default Re: Getting a SIGSEGV error when loading a pixmap

    I thought you might be correct d_stranz, so I dissected the image and determined that it only has a depth of 8.

    So, in the Qt 5.9 documentation under the Qt 5.8 - Qt GUI - C++ Classes – QpixmapCache description, it states in the ‘Detailed Description’ section, that “The initial cache limit is 10240 KB (10 MB); you can change this by calling setCacheLimit() with the required value. A pixmap takes roughly (width * height * depth)/8 bytes of memory.”

    If an image is 2000 pixels by 2000 pixels and the depth is 8 pixels, I get 4,000,000 divided by a depth of 8 bits per pixel = 500,000. Divide that by 8 bytes of memory (or should I divide by 64 bits of memory) I get 62,500. Therefore, two images would require a cache size of 125,000 bits, bytes or kilobytes?????

    Based on the above documentation, I am assuming that (width (in pixels) * height (in pixels) * depth (bits per pixel)) / bytes of memory returns a value that is in bytes. However it could just as easily be bits, bytes or KB. If someone could provide clarification on this, it would be highly appreciated.

  4. #4
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,324
    Thanks
    316
    Thanked 871 Times in 858 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Getting a SIGSEGV error when loading a pixmap

    Try the math again: (width * height * depth) / 8 = (2000 * 2000 * 8)/8 = 4 million bytes. "depth" is always in bits / pixel (not pixels), and the final division by 8 converts bits to 8-bit bytes.

    After you load the image, what does QPixmap::depth() say?
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

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

    Corny (23rd May 2017)

  6. #5
    Join Date
    Nov 2016
    Location
    Ridgecrest California
    Posts
    33
    Thanks
    11
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt5
    Platforms
    Windows Android

    Default Re: Getting a SIGSEGV error when loading a pixmap

    Yeah you're right, thanks. I divided instead of multiplying.

    As to the depth of the pixmap, it fails when loading so I can never get to the point to use the QPixmap::depth() function. The only data that the Locals and Expressions window displays for the image information is the following; width: 2000, height: 2000, nbytes: 16000000, format: 456327200, data: 0x6bcce780. Would I be wrong to assume that nbytes is the number of bytes? In any event, not sure that any of these values represent the depth.

    But, thanks to your assistance, I've eliminated the SIGSEGV issue (at least for now) and now receive "can't find linker symbol for virtual table for `QPixmap' value" in the application output. I'm going to do some searching to see I if can figure this new one out. I'm sure I'll post again if I can't. So d_stranz, thank you very much for your support to date.

Similar Threads

  1. Replies: 2
    Last Post: 11th October 2013, 11:16
  2. SIGSEGV Error when debugging with Qt creator.
    By jiapei100 in forum Qt Programming
    Replies: 5
    Last Post: 22nd July 2012, 12:19
  3. SIGSEGV Error: Very Strange
    By grayfox in forum Qt Programming
    Replies: 18
    Last Post: 16th January 2012, 14:50
  4. Qt OpenCV SIGSEGV error help
    By bobo in forum Newbie
    Replies: 3
    Last Post: 13th June 2011, 20:03
  5. Pixmap height / width without loading it
    By bunjee in forum Qt Programming
    Replies: 1
    Last Post: 29th November 2007, 07:10

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.