[openal] OpenAL realloc crash

roger roger at egosoft.com
Tue Sep 13 02:31:32 EDT 2016


Hi,

Thanks for the info, I'll check out git.
Generally, is it advisable to just use 'latest' or is it better to wait 
for a stable-release?
In the latter case, is there a (rough) schedule for when the next 
stable-release is planned?

Regards,
   Roger

On 9/9/2016 5:43 PM, Chris Robinson wrote:
> On 09/09/2016 02:57 AM, roger wrote:
>> Notice the memory is allocated using al_calloc, which does an al_malloc
>> with several #ifdef'ed implementations inside.
>> One of them does "manual alignment", another is using _aligned_malloc.
>> In our specific case _aligned_malloc is being used.
>>
>> Now we can get into a situation where we actually need more voices,
>> which is handled in alSourcePlayv like this:
>>
>> ...
>>
>> Notice it does a realloc - but that doesn't match with what al_malloc
>> did
>
> Hi.
>
> Thanks for reporting this. This has already been fixed in the Git 
> version, along with most other uses of realloc (it's still used in a 
> few places, but they are using standard malloc/calloc/free as well).
>
>>     It probably needs something similar to al_free, where it uses the
>> 0x55 and 0x0 markers to get back the original unaligned address, and
>> then manually align again on the realloc'ed address.
>
> Unfortunately, there's no guarantee that a realloc function for 
> aligned memory will be available (C11 doesn't define one, and manual 
> alignment would be very tricky since it needs to know the size of the 
> previous allocation). The only way to safely do it is to allocate 
> another block, copy the contents, then free the old pointer. Which is 
> a shame when it could reuse the same address and just shrink (or grow, 
> if enough head space is there) the amount of memory used by it.
> _______________________________________________
> openal mailing list
> openal at openal.org
> http://openal.org/mailman/listinfo/openal

-- 
Best Regards

Roger Boerdijk

EGOSOFT GmbH, Heidestrasse 4, 52146 Würselen, Germany
Tel: +49 2405 4239970, www.egosoft.com
Geschäftsführer: Bernd Lehahn, Handelsregister Aachen HRB 13473



More information about the openal mailing list