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

When to call MagickRelinquishMemory?

Post by oliver.andrich » 2006-10-03T20:04:42-07:00


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

Best regards,

User avatar
Site Admin
Posts: 10996
Joined: 2003-05-31T11:32:55-07:00

Post by magick » 2006-10-03T20:25:18-07:00

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