Re: “EXC_BAD_ACCESS” object is not nil but not accessible
Re: “EXC_BAD_ACCESS” object is not nil but not accessible
- Subject: Re: “EXC_BAD_ACCESS” object is not nil but not accessible
- From: Marco Frisan <email@hidden>
- Date: Mon, 17 Jan 2011 06:19:39 +0100
Il giorno 17/gen/2011, alle ore 04.04, Kyle Sluder ha scritto:
> On Sun, Jan 16, 2011 at 4:48 PM, Marco Frisan <email@hidden> wrote:
>> Yes I know that. The problem is that I am was not able to find which pointer. And the reason I am not able to find it is that the line that cause the application block is:
>>
>> NSDictionary * attributes = _record.attributes;
>>
>> inside the numberOfRowsInTableView: method of my custom class VLVolumeDetailsViewController.
>>
>> I checked with debugger and _record, that points to a VLDiskItemRecord object, is not nil.
>> attributes should be not nil too and are retained by the object pointed by _record when they are initialized.
>
> Just because they're not nil doesn't mean they point to valid objects.
> The objects might have been freed.
>
> First, make sure you're using Build & Analyze. This will catch many
> common memory management errors. If that doesn't find the problem, run
> with the Zombies instrument, which will track object allocations and
> frees and pinpoint where your object is going away.
>
> It is better to do this rather than assume you have "fixed" the
> problem by using -initWithDictionary:copyItems:.
>
> --Kyle Sluder
Build and Analize builds succefully (no error, no warning, no analize errors). I launched Instruments with NSZombieEnabled, and I in this case I got a first track...
Finally I discovered this zombie. It was not the NSDictionary of attributes, neither my custom object VLDiskItemRecord. And the line pointed by the debugger as the cause of the error was not responsible of anything (apparently).
The zombie was a CFArray.
The place where zombie were addressed was was few lines later, where I get the two arrays sending allKeys and allValues messages to the _attributes dictionary and later, when I send the message objectAtIndex: to one of them, in the method tableView:objectValueForTableColumn:row:.
Actually the object pointed by _attributesKeys and _attributesValues were not retained.
Though I am surprised that an error in a method cause the debugger to place the error in a totally different method.
Thanks you all for help
_______________________________________________
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