AOMediaCodec / libavif

libavif - Library for encoding and decoding .avif files
Other
1.58k stars 202 forks source link

Feature request: setting custom memory allocator/free #1745

Open HappySeaFox opened 1 year ago

HappySeaFox commented 1 year ago

Hi!

Some libraries like libpng (png_create_read_struct_2, png_set_mem_fn) or libjxl (JxlMemoryManager) allow setting custom memory allocator that will be used by the library instead of the standard malloc/free. It would be great to have this feature in libavif.

cmb69 commented 1 month ago

Indeed, that is something that would be very useful for applications already having their own memory allocators. E.g. PHP uses this to be able to limit the amount of memory for a process/thread, what seems to be particularly relevant to reading of AVIF images from untrusted sources (the file might be small, but may use large amounts of memory when read).