Re: Accessing buffers in NSData/NSMutableData under garbage collection
Re: Accessing buffers in NSData/NSMutableData under garbage collection
- Subject: Re: Accessing buffers in NSData/NSMutableData under garbage collection
- From: Gordon Apple <email@hidden>
- Date: Mon, 18 Feb 2008 21:02:48 -0600
When I tried to integrate my Bezier text container under 10.5 GC, I
quickly found out that my object pointers that I had stored in a
NSMutableData dynamic buffers were deadly. The GC simply doesn't see them
and was ripping my objects out from under me. I changed it to use
NSMutableArrays containing object instead of structs (containing object
references) and everything started working again. I haven't determined how
much performance hit there was, but at least it now works.
> Message: 11
> Date: Mon, 18 Feb 2008 17:21:14 -0500
> From: Rick Hoge <email@hidden>
> Subject: Accessing buffers in NSData/NSMutableData under garbage
> collection
> To: email@hidden
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes
>
>
> I have a question about recommended coding style under GC, which I'll
> preface with some background.
>
> I've been trying to learn about garbage collection under Leopard by
> turning it on in some older apps and watching how they fail. As
> stated in the GC docs, you probably don't want to switch to GC in a
> mature application that was developed under the older memory
> management scheme. However studying the effects of GC in old apps
> was certainly helpful in planning better design patterns for future
> projects.
>
> One of the patterns that breaks badly is the following type of thing:
>
> float *myPointer = [[NSMutableData dataWithLength:size*sizeof(float)]
> mutableBytes];
_______________________________________________
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