Re: Memory management, when mixing C and ObjC
Re: Memory management, when mixing C and ObjC
- Subject: Re: Memory management, when mixing C and ObjC
- From: Nick Zitzmann <email@hidden>
- Date: Fri, 23 Jul 2004 09:55:23 -0600
On Jul 23, 2004, at 9:14 AM, Theodore H. Smith wrote:
But doesn't Cocoa manage to handle objects without any need for
explicit memory management, when we are dealing with pure ObjC code?
If I do this:
MyClass* obj = [MyClass new];
obj = 0;
doesn't that call MyClass's destructor, and then free the memory? (ala
Java).
No. That zeros out the "obj" class so the program can't send messages
to it anymore, and since it wasn't released or added to the autorelease
pool before that, it would leak memory.
Nick Zitzmann
<
http://www.chronosnet.com/>
_______________________________________________
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.