Re: What's most common cause of SIGSEGV and SIGBUS
Re: What's most common cause of SIGSEGV and SIGBUS
- Subject: Re: What's most common cause of SIGSEGV and SIGBUS
- From: Ken Tozier <email@hidden>
- Date: Sat, 13 Mar 2004 23:35:01 -0500
On Mar 13, 2004, at 10:37 PM, Julien Dufour wrote:
>
>
On Mar 14, 2004, at 2:26, Ken Tozier wrote:
>
>
Hello
>
>
> I wrote a WebView policy delegate which always runs once then crashes
>
> the app with either SIGSEGV or SIGBUS. Best I can figure is that
>
> somehow the class the delegate calls is dealloc'd more than once, but
>
> the only dealloc I explicitly define is in the document window
>
> dealloc method, so I'm not doing it.
>
>
>
> Any insights?
>
>
Simple question: are you sure your object is correctly retained? (the
>
first time it works because it has been autoreleased, the next time
>
the object has been deallocated and the code crashes).
It turns out that I was releasing the return from [aString
componentsSeparatedByString:delimString] inside a loop like so:
while (object = [enumerator nextObject])
{
kvParts = [object componentsSeparatedByString:@"="];
[keys addObject:[kvParts objectAtIndex:0]];
[values addObject:[kvParts objectAtIndex:1]];
[kvParts release]; // <- commenting out this line stops the crashes
}
Not releasing "kvParts" seems really leaky to me. Is this a real leak
or am I just not understanding how Cocoa memory management works?
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.