Re: help trying to locate sigsegv error please
Re: help trying to locate sigsegv error please
- Subject: Re: help trying to locate sigsegv error please
- From: Thomas Harrington <email@hidden>
- Date: Fri, 15 Aug 2003 12:57:04 -0600
On Thursday, August 14, 2003, at 01:23 PM, Ben Dougall wrote:
does the fact that my app exits, always with the same input with
signal 11 (SIGSEGV) sporadically, strongly point towards a memory
management problem?
SIGSEGV strongly points to a memory management problem, full stop,
regardless of anything else you might say.
the reason i mention 'same input' and 'sporadically' is because i'm
doing a lot of stepping along and reading data from an NSData object
using a pointer gained by -bytes and adding adding another variable to
that pointer, so over run is a possibility there and that error could
be caused by over run like that? but the same input sometimes crashes,
sometimes doesn't, so for that reason i don't think it is over
stepping - it would over run every time and exit with signal 11
sigsegv every time right?
Not necessarily, no. Without seeing code it's impossible to be
specific, but I can give a scenario where crashes would be sporadic.
Say you're using an uninitialized pointer somewhere. It's got a value,
but you can't be certain what that value is. You might try
dereferencing this pointer and using the result, or you might write
data to its address, or you might use it in some other way. Sometimes
the pointer's value may be something which causes a crash, and
sometimes may not. It's always an error, only sometimes the pointer's
value causes the consequences to go unnoticed.
signal 11 (SIGSEGV) is cuased by attempting to access something that i
shouldn't be - is that correct? so releasing / deallocating an object,
then trying to access it in some way would give that error for sure?
You could cause this signal by mishandling Objective C retain counts
and using something that's been released. But you could also cause it
in a variety of other ways.
i haven't got a clue what's causing it. there's quite a lot of code
but all the alloc and init situations, which there aren't many of, are
tallied to releases and there are no extra releases.
can it be cause by not releasing something?
Failing to release an object you don't need anymore would cause a
memory leak, but should not on its own lead to an application crash.
--
Tom Harrington
email@hidden
_______________________________________________
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.