Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

API Consistency (was Re: performance issues)



The thing that bothers me about advice like this is that it encourages API mixing, likely for no performance gain and at the expense (potentially) of future portability.*

I don't think POSIX memory calls will be disappearing from Mac OS any time soon, but if you're programming with the Carbon API, why not stick to Carbon API calls? If NewPtr is a wrapper on malloc, then I would lean towards keeping NewPtr in a Carbon-based project. It seems like a very rare scenario that calling malloc directly instead of via NewPtr would cause a measurable performance problem. Both to avoid needless work now, and to maintain the "carbon paradigm" for both reading and (potentially) future portability, I am having a hard time accepting the advice to switch from Carbon to POSIX for all memory management.

Just from an API-integrity point of view, it seems like Apple should provide supported, fully-endorsed memory management routines as part of any framework API it provides.

Daniel

(*) I guess there's probably a good argument to be made that that any change from Carbon to POSIX would be an improvement to an application's long-term portabiility. Still, I say when in Rome, program as the Romans do :)

On Mar 29, 2005, at 9:49 PM, Chris Espinosa wrote:

"Mac OS X implements a highly-tuned, threadsafe allocation library, providing standard implementations of the malloc, calloc, realloc, and free routines, among others. If you are allocating memory using older routines such as NewPtr or NewHandle, you should change your code to use malloc instead. The end result is the same since most legacy routines are now wrappers for malloc anyway."
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden

This email sent to email@hidden

References: 
 >performance issues (From: "Edwards, Waverly" <email@hidden>)
 >Re: performance issues (From: Chris Espinosa <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.