I'm about to start writing an iOS game and I'm going to use mainly C++/C for the core gameplay logic.

I really like pre-allocating everything in the game and try to avoid any dynamic allocations as much as possible. With my own C++/C code it's not a big deal. However there are some ObjC libraries which I'd like to re-use and I'm not sure how to inject my custom memory allocator to Cocoa based classes.

Is there any central 'inject point' in Cocoa where I can do that?

link|improve this question
Why are you trying to inject your custom memory allocator into other libraries? This sounds like obsessive pre-optimization. – thedaian Aug 26 '11 at 13:39
I'd like to know exactly how much memory is utilized and in what components. – pachanga Aug 26 '11 at 13:46
4  
@thedaian: On the contrary, injecting memory allocators is a key part of measurement, which is exactly how you optimize properly. – Joe Wreschnig Aug 26 '11 at 14:33
feedback

1 Answer

This is all highly theoretical but you may be able to use categories (Mac Developer Tips) to override NSObjects (Apple Developer) alloc and dealloc methods.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.