• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
re: Is malloc/new thread safe on OSX?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Is malloc/new thread safe on OSX?
      • From: Boyd Collier <email@hidden>
  • Prev by Date: Re: "Run" runs the app in the wrong target
  • Next by Date: NSStatusMenu Icon Size and Dock Icons
  • Previous by thread: Re: Is malloc/new thread safe on OSX?
  • Next by thread: Re: Is malloc/new thread safe on OSX?
  • Index(es):
    • Date
    • Thread