Re: Unarchiving issues
Re: Unarchiving issues
- Subject: Re: Unarchiving issues
- From: James Maxwell <email@hidden>
- Date: Mon, 2 Aug 2010 13:09:13 -0700
Thanks, everybody. Of course, you're all absolutely right, the buffer from decodeBytesForKey is temporary. I'd just assumed the bytes would be written to my malloced buffer, not realizing I needed to explicitly copy them.
Problem solved.
cheers,
J.
On 2010-08-02, at 10:56 AM, Graham Cox wrote:
>
> On 03/08/2010, at 3:46 AM, James Maxwell wrote:
>
>> continuations = (float*)[aDecoder decodeBytesForKey:@"continuations" returnedLength:&size];
>
>
> I expect the returned bytes are autoreleased. The docs don't state this explicitly, but the similar method -decodeBytesWithReturnedLength: states "If you need the bytes beyond the scope of the current autorelease pool, you must copy them.".
>
> Try it and see if it solves the issue, sounds like a straightforward memory bug.
>
> --Graham
>
James B Maxwell
Composer/Doctoral Student
School for the Contemporary Arts (SCA)
School for Interactive Arts + Technology (SIAT)
Simon Fraser University
email@hidden
email@hidden
_______________________________________________
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