[Interest] Error : QImage: out of memory,

Igor Mironchik igor.mironchik at gmail.com
Mon Aug 1 16:50:45 CEST 2016


Hi,

You get this error in slot onImageReceived()?

or you are talking about this lines:

QImage img(cdata, 288, 352, QImage::Format_RGB888);
     img = img.scaled(QSize(288*1.5,352*1.5));
     delete[] cdata;


On 01.08.2016 17:24, Nilesh Kokane wrote:
> Hello,
>
> I've a function as follows. With this I get QImage: out of memory,
> returning null image, I dont allocate heap to QImage anywhere.
> but the crash happens at QImage img(cdata, 288, 352,
> QImage::Format_RGB888). Any clue.
> If the QImage is allocating the memory to the heap internally how to free that?
>
>
>
> void AddToQueue(/*param*/)
> {
>
>     /*
> ..
>     */
>
>      QImage ampl_image = convertImageWithImageAdjust(/*param*/);
>      QImage dist_image = convertImageWithImageAdjust(/*param*/);
>      emit imageReceived(ampl_image, dist_image, FPS);
>
> }
>
> QImage convertImageWithImageAdjust(/*param*/)
> {
>    /*
>
> ..
>
>    */
>      QImage img(cdata, 288, 352, QImage::Format_RGB888);
>      img = img.scaled(QSize(288*1.5,352*1.5));
>      delete[] cdata;
>      return img;
> }
>
>
> void GestureCamCorder::onImageReceived(const QImage &amplImage, const
> QImage &distImage)
> {
>      QPixmap tempImage = QPixmap::fromImage(amplImage);
>      ui->amplImage->setPixmap(tempImage);
>
> }




More information about the Interest mailing list