Mac Carbon |
Author |
Message |
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Tue Apr 03, 2007 9:25 pm Post subject: Memory |
|
|
ADC: TN2130 - Memory Allocation Recommendations on Mac OS X
"The Macintosh Memory Manager provides in MacMemory.h the four memory
allocation functions NewPtr, NewPtrClear, NewHandle, and NewHandleClear.
... On Mac OS X, those four functions eventually call the C library function
malloc with a thin overhead.
Use DisposePtr to deallocate the memory allocated by NewPtr or NewPtrClear
and you can use SetPtrSize to resize the allocated memory (beware, even
on Mac OS X, SetPtrSize may fail)." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Tue Apr 10, 2007 11:10 pm Post subject: |
|
|
Must-see documnt at ADC: Ownership Policy
"Applications using Core Foundation constantly access and create and dispose
of objects. In order to ensure that you do not leak memory, Core Foundation
defines rules for getting and creating objects."
Same place: The Create Rule
"The object-creation functions have “Create” embedded in the name and
the object-duplication functions have “Copy” embedded in the name. If you
own an object, it is your responsibility to relinquish ownership using
CFRelease() when you have finished with it." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Thu Mar 04, 2010 2:14 am Post subject: |
|
|
so - OSX API Question: Where does BlockZero live?
"BlockZero is a function that seems to zero a block of memory. It lives in
CoreServices and is defined in MacMemory.h. The problem is that the fun-
ction is unavailable to apps being compiled as 64bit (which is the default;
hence my problem)." |
|
Back to top |
|
|
|