I've a mixed project with a huge ammount of old C code and some C++ code as a wrapper linked together in a single binary.
The C code uses a mutex to make malloc
-memory-management thread safe, the C++ part does not care pthreads. Will the usage of malloc
together with new
be thread-safe, if these are true:
malloc
,realloc
andfree
are protected by a mutex.- The standard
new
-operator is used (I think, it's a pthread-enabled version by default, if pthreads are used, right?) - Memory allocated by
malloc
is never freed bydelete
and vice-versa.