Re: NSAllocateCollectable memory allocation problem
Re: NSAllocateCollectable memory allocation problem
- Subject: Re: NSAllocateCollectable memory allocation problem
- From: julius <email@hidden>
- Date: Mon, 21 Jun 2010 16:08:16 +0100
On 21 Jun 2010, at 15:47, Michael Babin wrote:
>
> On Jun 21, 2010, at 7:06 AM, julius wrote:
>
>> Inside MyControl define three pointers of type CGFloat , e.g CGFloat * mem1, mem2, mem3;
>> and declare them as @property GFloat * mem1; etc with corresponding @synthesize statements.
>> Declare a MyControl method that allocates memory to mem1 etc, e.g.
>> self.Mem2 = (CGFloat *)NSAllocateCollectable((sizeof(CGFloat) * 22000),NSScannedOption);
>
> I believe you need to add a __strong qualifier to your pointers (i.e., __strong CGFloat * mem1;), to prevent them from being collected.
Michael Thanks!
Now it works
>
> On 21 Jun 2010, at 13:06, Jonathan Mitchell wrote:
>
> I cannot really follow all this.
> Is not possible that your allocations are simply getting collected and realloacted?
>
> Extremely^2 unlikely that there is any sort of problem with NSAllocateCollectable.
> I suggest making up a very simple project to convince yourself of the fact.
Jonathan thanks for the suggestion.
I had in fact already done that.
I had created what I thought was a scenario that would bring out the problem.
Of course I overlooked the clue provided by memory being allocated ok when the calls to NSAllocateCollectable were being made in the same method. The penny had simply failed to drop.
Thanks again
Julius
http://juliuspaintings.co.uk
_______________________________________________
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