Re: crashes loading saved file
Re: crashes loading saved file
- Subject: Re: crashes loading saved file
- From: Jens Alfke <email@hidden>
- Date: Mon, 28 May 2012 22:56:45 -0700
On May 28, 2012, at 10:51 PM, I wrote:
> In general, look at your graph and figure out the minimum number of object relations you need to archive to reconstruct its structure. Then archive only those, and recreate the rest at load time.
I just had another thought. Are you using linked lists? I suspect those are rather bad for the unarchiver, since it's likely to end up recursing all the way down the list, resulting in O(n) stack depth. That is, during -initWithCoder: for an item in the list, it'll be asked to unarchive the "next" property, which ends up calling -initWithCoder: for the next item in the list, and so on until it hits the end and can finally unwind the stack.
If so, it would be a lot more efficient for the archiver if you stored the list as an NSArray, since that allows it to instantiate one item at a time (breadth-first instead of depth-first, basically.)
—Jens
_______________________________________________
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