To answer your question: No, the property and synthesize call won't allocate any memory. You have to do it. If you don't, the myString actually points to nil upon construction.
Don't use Michael's example though, as it leaks memory.
Use
self.myString = @"Hello Miek";
The @ literal is actually equivalent to calling [NSString stringWithString:] class method
which returns an autoreleased (and of course allocated) object. Alternatively you could use this
NSString *aString = [[NSString alloc] initWithString: @"string...."];
self.myString = aString;
[aString release];
Also note, you should declare the property as copy instead of retain for NSStrings.
In your dealloc, you have to release myString too.
And finally, Patrick's answer isn't 100% correct, since the synthesised setter for the retained property looks like this:
-(void) setMyString: (NSString*) string {
[myString release];
myString = [string retain];
}
And on a final note related to Patrick's answer, it is not recommended to use setters in
the init method. So rather than
self.myString = @"xyz";
It is recommended to access the iVar directly:
//or _myString, if you synthesized it that way of course
myString = @"xyz";
[myString retain];
Cheers (long answer, had a little time on my hand ;)