Using c++ in iOS application(memory management)
So... When you use C++ 开发者_JAVA技巧inside iOS app should you handle all the memory management by yourself or does it really matter? Sorry if this question is dumb.
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.
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.
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.
精彩评论