Skip navigation.
 
mlRe: App exits on alloc
FROM : Alex Rice
DATE : Mon Nov 18 09:25:37 2002

On Tuesday, November 12, 2002, at 01:29  PM, David Sinclair wrote:

> I have a perplexing problem, and can't find a solution in the archives
> etc.
>
> I have an object in one file, and am alloc'ing it from another object.
>  But when I do, the app exits.  This is just alloc'ing it -- it
> doesn't even get to the init.  Even with everything stripped out of
> the first object, it exits.  Yet if I put the first object in the same
> file as the second, it works fine.  And I can alloc other objects from
> the second one.  When it exits, the PB status bar displays "Program
> exited with status value:1."
>
> Anyone else ever had something like this?


Hi, I didn't see any followups to your post. I'm not really
understanding the problem though. Would  you post some code showing how
you are alloc-ing, init-ing and retain-ing the object? Also seeing the
code for it's -init method and dealloc method would be helpful.

If you are calling -alloc yourself, you are responsible for releasing
or autoreleasing the object. What are you doing with the object after
alloc-ing it? Are you autoreleasing or releasing it before using or
returning the object?

All of my memory related crashes in ObjC have been due to me releasing
an object when it should have been autoreleased, or not retaining an
object that was autoreleased when I received it.

Alex Rice <<email_removed>>
Mindlube Software
http://mindlube.com/
_______________________________________________
cocoa-dev mailing list | <email_removed>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

Related mailsAuthorDate
mlApp exits on alloc David Sinclair Nov 12, 21:29
mlRe: App exits on alloc Alex Rice Nov 18, 09:25
mlRe: App exits on alloc David Sinclair Nov 18, 18:52