Reputation: 8168
now i using
@property (nonatomic, retain) NSDictionary *currentAttribute;
if i use copy or assign instead of retain is it more difference in memory performance?
Upvotes: 2
Views: 1548
Reputation: 723598
Declaring it copy
would mean you get an entirely new NSDictionary
object for use with your class. If it's quite a large dictionary this can be a performance hit; not very noticeable, but significant anyway. By retain
ing it, you simply give your class its own pointer to the same NSDictionary
instance.
Declaring it assign
puts your application at risk of crashing in case the NSDictionary
is autoreleased. If it ends up in the pool and gets deallocated because the pool reduced its retain count to 0, your class won't get to access it anymore, causing a crash.
Upvotes: 8