Assuming that header declaration contains
@property(nonatomic, assign) DoublyLinkedList *doublyLinkedList;
Is there any difference between
[[self doublyLinkedList] release];
[self setDoublyLinkedList:nil];
and
[doublyLinkedList release];
doublyLinkedList= nil
Is one preferred over another? Why?
There is no difference.
The second option might be ever so slightly faster, because it doesn’t use the getter/setter methods.
Just so we’re clear, are you retaining doublyLinkedList when you assign it? Because otherwise you’re over-releasing.
And unless you have a good reason, I would skip all this and use retain instead of assign, and self.doublyLinkedList = nil to release/clear it.
e.g.
definition
in use
and on dealloc