What's the difference between setting an object to nil vs. sending it a release message in dealloc

前端 未结 4 757
我在风中等你
我在风中等你 2020-12-09 13:49

I have Object:

MyClass *obj= [[MyClass alloc] init];

What\'s the difference between:

[obj release]; // Only obj own this ob         


        
4条回答
  •  攒了一身酷
    2020-12-09 14:12

    Is It Necessary to Set Pointers to nil in Objective-C After release?

    Release, Dealloc, and the Self reference

    Setting an object nil versus release+realloc

    Read the above. They answer your Q comprehensively

提交回复
热议问题