问题描述:

So... When you use C++ inside iOS app should you handle all the memory management by yourself or does it really matter? Sorry if this question is dumb.

网友答案:

Use C++ memory management for C++ objects; use Objective-C memory management for Objective-C objects. Basically, you need to manage all your memory somehow or other. What you do to free/delete/-release a block or object depends entirely on whether you malloc/new/-alloc to create it.

网友答案:

Don't know about Objective C but in modern C++ you use smartpointers. You don't have to free or delete anything. All that is taken care of. Its as good as garbage collection but much more efficient.

网友答案:

Sorry to say but it kind of is, you always have to manage your own memory in iOS apps unless you particularly don't care about using too much memory.

相关阅读:
Top