Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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?

share|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. –  user744 Aug 26 '11 at 14:33

1 Answer 1

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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