On Sunday, December 17, 2000, Jacques A. Vidrine wrote:
> I may have missed your point ... or maybe you are just agreeing with 
> what I wrote.  For this particular implementation of free, you get the
> following for `free(foo)' when foo == NULL:
> 
>    function call and stack overhead for free()
>    lock something if we are threaded
>    pointer assignment
>    increment
>    compare and branch
>    function call and stack overhead for ifree()
>    compare and branch
>    unwind ifree()
>    More stuff if HAVE_UTRACE
>    decrement
>    unlock something
>    unwind free()

> FreeBSD's free() is not optimized for freeing NULL pointers.  Not
> that I think it should be -- as I said, that would be silly.

   The code I pasted _was_ FreeBSD's code, and it does optimize
for freeing NULL pointers.  You can still check for the pointer
if you wish, before you call free().

-- 
+-------------------+-------------------------------------+
| Chris Costello    | Backups?  We doan *NEED* no         |
| [EMAIL PROTECTED] | steenking baX%^~,VbKx    NO CARRIER |
+-------------------+-------------------------------------+


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to