[ECOS] Lack of mutex protection for malloc and free ?

Harry Hart harry@vitiate.com
Thu May 29 05:33:00 GMT 2003


Hello -

Perhaps I'm misunderstanding the relevant code, but it appears that 
dlmalloc.cxx is compiled with MALLOC_LOCK and MALLOC_UNLOCK defined as 
empty statements.  Is this correct / intentional?  Or am I missing 
something?  If this is the case, what prevents memory corruption when 
two processes attempt to execute malloc() or free() at the same time?

Here's my logic: malloc() calls 
Cyg_Mempool_dlmalloc_Implementation::try_alloc() (in dlmalloc.cxx). 
 This function calls the macro MALLOC_LOCK.  However, this macro seems 
to be an empty statement.  I don't see any call to suppress interrupts 
or lock the scheduler.

Can someone tell me what I'm overlooking?  

Thanks -
- Harry



-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss



More information about the Ecos-discuss mailing list