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 protected])
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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]