Re: malloc/free problems within a thread
Re: malloc/free problems within a thread
- Subject: Re: malloc/free problems within a thread
- From: Bill Bumgarner <email@hidden>
- Date: Sat, 29 Jul 2006 14:58:59 -0700
On Jul 29, 2006, at 1:47 PM, Ken Tozier wrote:
I have a process that spawns threads and inside these threads I
malloc/free some memory but I'm getting either "xxx has exited due
to signal 11 (SIGSEGV)" or "sigbus 10" errors. I know from past
experience that these most likely indicate a non-retained object,
problem is though that I checked very carefully and everything that
I want to keep around is definitely retained. Could the fact that
some objects were created inside a thread's NSAutorelease alloc/
release override the retain commands?
It seems like the NSAutorelease pool destroys all objects created
within it regardless of whether they have a retain or not. That's
the only thing I can think of. Is that what it does?
Definitely not. The autorelease pool just decrements the retain count
of every contained object by the number of times it has been
autoreleased into that pool. No magic involved.
It sounds like you are trashing memory somewhere or you have an object
in an autorelease pool in one thread that is being accessed after the
pool is released, likely in a different thread (since your error
messages are changing).
Given that malloc is complaining about incorrect checksums, etc, it
really sounds like trashed memory.
b.bum
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden