objective c - Should I dealloc NSImage? -


i writing simple obj-c app. far i've never had alloc , gave granted arc take care of memory management.

but have call:

nsimage *myimage = [[nsimage alloc] initbyreferencingfile: pathtomyimg]; 

after i'm done myimage should manually dealloc it?

if you’re using objective-c arc (which default, , said anyway), there no difference in required memory management between factory method-style instantiation , [[nsimage alloc] init]-style instantiation. create automatically released when last strong reference goes out of scope (or object holding reference’s last strong reference goes out of scope).

if weren't using arc, you’d have manually [myimage release] when done it, there’s no reason not unless you’re writing code older project.


Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -