• 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 it guaranteed safe to pass NULL to free()?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Is it guaranteed safe to pass NULL to free()?


  • Subject: Re: Is it guaranteed safe to pass NULL to free()?
  • From: Terry Lambert <email@hidden>
  • Date: Wed, 8 Oct 2008 19:08:06 -0700

On Oct 8, 2008, at 5:13 PM, Sean McBride wrote:
My understanding is that one can safely pass NULL to free(). I've seen
this stated in man pages on various unices. However, I notice that Mac
OS X 10.5's man page for free makes no comment about passing NULL. Is
it guaranteed safe by posix or the C standard, or not?

Yes, by both.

	<http://www.opengroup.org/onlinepubs/009695399/functions/free.html>

Also The ANSI/ISO C specification, section 7.20.3.2, The free function, paragraph 2.

This is to accomodate historical implementations of the free() functions which, when called with a NULL argument, manually triggered garbage collection on freed but uncollected pages, for example in power-of-2 allocators.

-- Terry
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Is it guaranteed safe to pass NULL to free()? (From: "Sean McBride" <email@hidden>)

  • Prev by Date: Re: Is it guaranteed safe to pass NULL to free()?
  • Next by Date: New to Mac
  • Previous by thread: Re: Is it guaranteed safe to pass NULL to free()?
  • Next by thread: New to Mac
  • Index(es):
    • Date
    • Thread