当前位置: 动力学知识库 > 问答 > 编程问答 >

cocoa touch - Using c++ in iOS application(memory management)

问题描述:

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.

分享给朋友:
您可能感兴趣的文章:
随机阅读: