[Ur] missunderstanding - or serious memory handling issue?

Adam Chlipala adamc at impredicative.com
Tue Dec 7 20:16:39 EST 2010


Marc Weber wrote:
> You try realloc and if the new pointer is a different one you fail -
> causing all callback functions to be called maybe accessing memory
> which may have been overridden by other threads because realloc allowed
> it to be reused.
>
> So if uw_malloc returns memory blocks which you can reuse in those
> handlers than its a bug.
>    

None of the callbacks introduced by the compiler itself will ever touch 
memory in the context-local heaps (which is the kind of memory that 
uw_malloc() manages).  If you follow this same rule in the callbacks you 
introduce with your FFI code, everything will be fine.

This sounds like another fact that I should add to the manual.  Thanks 
for pointing it out. :)



More information about the Ur mailing list