This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Lack of mutex protection for malloc and free ?
- From: Harry Hart <harry at vitiate dot com>
- To: ecos-discuss at sources dot redhat dot com
- Date: Thu, 29 May 2003 00:12:25 -0400
- Subject: [ECOS] 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