[Ur] missunderstanding - or serious memory handling issue?

Marc Weber marco-oweber at gmx.de
Tue Dec 7 20:30:30 EST 2010


Excerpts from Adam Chlipala's message of Wed Dec 08 02:16:39 +0100 2010:
> 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). 

Think about it this way:

request 1: is using uw_malloc to store some pointers in the memory block
request 1: is using uw_malloc to get a huge memory block. realloc will
              be called returning a different pointer.
              context change. request2 is issued.
request 2: is using uw_malloc to get some bytes. It is writing to them.
              Those bytes happen to be the ones I stored pointers in
              (request 1)
              calling sleep 3
request 1: now free is invoked. Trying to read pointer from memory which
            was overridden by request 2:
request 1: segfault. fine,

By free I mean uw_register_transactional free callback or
uw_push_cleanup callback functions.

You're right: ur itself is not writing to the memory. There is still a
segfault. What's wrong ? Should I be using malloc only?

Marc Weber



More information about the Ur mailing list