When to call MagickRelinquishMemory?

The MagickWand interface is a new high-level C API interface to ImageMagick core methods. We discourage the use of the core methods and encourage the use of this API instead. Post MagickWand questions, bug reports, and suggestions to this forum.
Post Reply
oliver.andrich

When to call MagickRelinquishMemory?

Post by oliver.andrich »

Hi,

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

Best regards,
Oliver
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Post 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().
Post Reply