NSData release seg fault. Whoops.
NSData release seg fault. Whoops.
- Subject: NSData release seg fault. Whoops.
- From: nik heger <email@hidden>
- Date: Tue, 20 Jan 2009 11:39:36 +0700
I figured out how to make this code "work" but I still don't know what
the problem was. Can someone enlighten me?
- (void)testSegFault {
int size = 8;
uint8_t *bytes = malloc( size * sizeof(uint8_t) );
NSData *data = [NSData dataWithBytesNoCopy:bytes length:size];
[data release];// this causes a seg fault.... comment it out and
everything works.
}
According to the NSData documentation, the NSData object will take
ownership of the array I created with malloc. So far so good but why
don't I have to release it? Or is there something sinister going on
with the uint8_t data type vs. size of the byte(?) array?
thanks,
Nik
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden