This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Lack of mutex protection for malloc and free ?


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]