Re: Crash after [NSData dataWithData:(NSMutableData *)]
Re: Crash after [NSData dataWithData:(NSMutableData *)]
- Subject: Re: Crash after [NSData dataWithData:(NSMutableData *)]
- From: email@hidden
- Date: Tue, 26 Jul 2005 16:07:57 -0700
On Jul 26, 2005, at 6:48 AM, j o a r wrote:
This is Cocoa memory management 101...
A precise description of my Cocoa experience! :-)
On Jul 26, 2005, at 6:52 AM, Nicko van Someren wrote:
You did not get the sourceData object with new, alloc or copy,
therefore you do not "own" the object and you should not release it
since it is an autorelease object.
Ah, that's the problem -- I was under the incorrect impression that
the <thing>With<Condition> methods behaved like [[Thing alloc]
initWith<Condition>].
So, if I had done [[NSData alloc] initWithData:...] instead of
[NSData dataWithData:...], the result it would not be autoreleased
and would have a retain count of 1. Did I get that right?
Thanks again.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden