Hi,

On Thu, Jan 10, 2013 at 11:33 AM, Luca Barbato <[email protected]> wrote:
> On 10/01/13 20:12, Dale Curtis wrote:
>> From: "PaweÅ‚ Hajdan, Jr" <[email protected]>
>>
>> Memory passed to av_realloc cannot be allocated using memalign.
>>
>> From realloc(3):
>>
>> The realloc() function changes the size of the memory block pointed to
>> by ptr to size bytes. (...) Unless ptr is NULL, it must have been returned
>> by an earlier call to malloc(), calloc() or realloc().
>>
>
> The patch itself is fine (and queue locally), I'm trying to figure out
> what's the best to avoid such issues since few malloc implementation
> support aligned realloc.
>
> - in debug mode mark malloc and realloc memory differently and assert
> accordingly in realloc, and make quite clear we have 2 kinds of memory.
>
> - support aligned realloc (means wasting 8 bytes per allocation if we
> want to keep the same signature, or introduce av_realloc2 that takes in
> account the size to be preserved)

Why so complex? Is there currently a need for an aligned realloc? If
not, don't add one. Wait until it becomes necessary. Likely, it will
never be necessary.

(Incidentally, if there were a real use case for aligned realloc,
Linux and Mac would probably support it natively. They don't. Probably
- again - because there is no need for it.)

Ronald
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to