Take the 2-minute tour ×

I want to know what is difference between self.object and self->object? how can we able to release memory in ARC using self?

share|improve this question

2 Answers 2

up vote 2 down vote accepted

self is a pointer, so self->object correctly references object.

self.object however is Objective-C syntactic sugar for [self object] and will call the getter method (-(Object *)object) (or the setter method [self setObject:] if you are assigning).

If you are using ARC then you don't explicitly need to do anything to release memory.

share|improve this answer

self.object calls the setter method, which does memory management such as retaining the object. self->object sets/accesses the object directly which doesn't do any memory management. Generally you wouldn't want to access an object's ivar directly, so just create setters/getters for object and use self.object.

share|improve this answer

Your Answer


