Page 1 of 1

When to call MagickRelinquishMemory?

Posted: 2006-10-03T20:04:42-07:00
by oliver.andrich
Hi,

when do I have to call MagickRelinquishMemory? Everytime a function of MagickWand returns a char*?

Best regards,
Oliver

Posted: 2006-10-03T20:25:18-07:00
by magick
Unless the method has a const signature, you own whatever is returned by a MagickWand method and are responsible to free the memory when you are done with the object. For example MagickGetImageFilename() returns the image filename. Since it is not declared const char * you are responsible for freeing it with MagickRelinquishMemory(). GetImageFromMagickWand(0 returns an image. Free it with MagickDestroyImage(). Darn, there is no MagickDestroyImage(). Until we correct this problem, use DestroyImage().