egor7
egor7

Reputation: 4941

How to free memory allocated by ImageMagick GetImageHistogram()?

I'm using ColorPacket *GetImageHistogram(const Image *image, ...) to extract an histogram. I see IM sources and found, that GetImageHistogram allocates memory via:

  histogram=(ColorPacket *) AcquireQuantumMemory((size_t) cube_info->colors,
    sizeof(*histogram));

How should I free this memory?

Upvotes: 0

Views: 2966

Answers (1)

nwellnhof
nwellnhof

Reputation: 33618

To free memory allocated with AcquireQuantumMemory, use RelinquishMagickMemory:

histogram = RelinquishMagickMemory(histogram);

See the API documentation. This function always returns NULL.

Upvotes: 1

Related Questions