Skip navigation.
Home
The QNX Community Portal

View topic - Problems freeing memory after PxLoadImage()

Problems freeing memory after PxLoadImage()

Isn't the name clear?

Problems freeing memory after PxLoadImage()

Postby juanplacco » Thu Jul 01, 2010 5:35 pm

Hi,
I'm having some problems freeing memory after load an image from file with PxLoadImage().

I tried

PhImage_t * image = NULL;

image = PxLoadImage ( "/tmp/image.png", NULL );

-- Set image to PtLabel (Pt_ARG_LABEL_DATA)

PhReleaseImage( image );
free ( image );

But it doesn't work well for me. There is still allocated memory after.

What's missing?

Regards,
JM
juanplacco
Senior Member
 
Posts: 318
Joined: Wed May 17, 2006 2:30 pm

RE: Problems freeing memory after PxLoadImage()

Postby mario » Thu Jul 01, 2010 5:54 pm

How can you tell memory is still allocated, what version of NTO are you using?
mario
QNX Master
 
Posts: 4132
Joined: Sun Sep 01, 2002 1:04 am

RE: Problems freeing memory after PxLoadImage()

Postby mario » Thu Jul 01, 2010 7:40 pm

As stated in the documentation you are missing image->flags |= Ph_RELEASE_IMAGE_ALL;
mario
QNX Master
 
Posts: 4132
Joined: Sun Sep 01, 2002 1:04 am

RE: Problems freeing memory after PxLoadImage()

Postby juanplacco » Fri Jul 16, 2010 8:31 pm

Hi!

mario... thanks for the answer, and sorry for the delay in my reply but it works fine, the thing is that I was facing other problem with PxLoadImage() that fried my brain.

After a week of debuging a SIGSEGV in some point of the code (after PxLoadImage) we realize that it seems that Photon can't manage well PNG files with transparencies. It was not the first logical cause of the segment violation because we have a lot of new code and we though that the problem was there... But it seems is not the case. At last, we tried with no transparencies or other format images (bmp, jpg) and we build some test application that loads and frees images (with PxLoadImage) every 50 msec and we let it running for a whole day. No problems. That's the story.

Does anybody knows if this is a documented issue?

Regards and thank you again,
JM
juanplacco
Senior Member
 
Posts: 318
Joined: Wed May 17, 2006 2:30 pm


Return to GUI Programming

Who is online

Users browsing this forum: No registered users and 1 guest