re: Is malloc/new thread safe on OSX?
re: Is malloc/new thread safe on OSX?
- Subject: re: Is malloc/new thread safe on OSX?
- From: George Warner <email@hidden>
- Date: Wed, 27 Aug 2008 10:33:07 -0700
- Thread-topic: Is malloc/new thread safe on OSX?
On Mon, 25 Aug 2008 14:51:35 -0700, Jeff Ray <email@hidden> wrote:
> I can't find an explicit statement about whether new and malloc are thread
> safe under OSX. Where should I be looking?
<http://developer.apple.com/technotes/tn2005/tn2130.html> says:
"The Macintosh Memory Manager provides in MacMemory.h the four memory
allocation functions NewPtr, NewPtrClear, NewHandle, and NewHandleClear. All
those functions are thread-safe starting with Mac OS X v10.3 but not in
previous versions. On Mac OS X, those four functions eventually call the C
library function malloc with a thin overhead."
If malloc wasn't thread safe then the Memory Manager APIs that eventually
call it couldn't be thread safe.
I don't know any place else where this is said on our web site.
But other sites that talk about POSIX and thread safety quote:
<http://math.arizona.edu/~swig/documentation/pthreads/> says:
"The POSIX threads specification does demand that the calls in the C library
(including malloc() and printf()) be thread-safe."
So for Mac OS X to be POSIX compliant malloc (and realloc and free) have to
be thread-safe.
--
Enjoy,
George Warner,
Schizophrenic Optimization Scientist
Apple Developer Technical Support (DTS)
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden