Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - memory leak in PxLoadImage (when repeating): (1 Item)
   
memory leak in PxLoadImage (when repeating)  
It isn't new topic, but in prevoius discussion I haven't found any real decision of my problem. So, I use PxLoadImage 
many times during my program session. If it is, for instance, the 300-th call of PxLoadImage I have memory fault. I 
understand that problem is connected with memory leaks. But I don't know how to free memory properly. How must I release
 memory?
My code:
PhImage_t *temp_image= PhCreateImage( 0, 256 , 256 , Pg_IMAGE_DIRECT_888, 0, 0, 1);
if ((temp_image=PxLoadImage(file_name,NULL))==NULL){
                    fprintf(stderr,"Error opening next path: %s\n",file_name);
		    PtExit(EXIT_FAILURE);		
...
temp_image->flags=Ph_RELEASE_IMAGE|Ph_RELEASE_PALETTE|		Ph_RELEASE_TRANSPARENCY_MASK|Ph_RELEASE_GHOST_BITMAP|
Ph_RELEASE_IMAGE_ALL;
PhReleaseImage(temp_image);
free(temp_image);