Messing about a bit, i have a working Adobe After Effects plugin with a bit of Obj-c / Cocoa in it (NSArray and custom objects – not ui stuff). The SDK guide states:-
Always use After Effects memory allocation functions. In low-memory conditions (such as during RAM preview), it’s very important that plug-ins not compete with After Effects for OS memory, and deal gracefully with out-of-memory conditions. Failing to use our functions can cause lock-ups, crashes, and tech support calls. Don’t do that.
If you’re wrapping existing C++ code, overloading new and delete to use our functions will save substantial reimplementation. On Windows, derive all classes from a common base class which implements new and delete.
so my question.. is something compatible with the above statement possible in Obj-c?
I could probably swizzle alloc on NSObject if absolutely necessary, although i have no idea if something like NSArray uses NSObject’s alloc method at all.
NSZone (which is what you’d need) is not extensible. CoreFoundation’s allocators are extensible, but not everything you’re allocating is a CF object underneath.
Unless you’re allocating hundreds of megabytes of memory in your Objective-C code, I wouldn’t worry.