Memory management, when mixing C and ObjC
Memory management, when mixing C and ObjC
- Subject: Memory management, when mixing C and ObjC
- From: "Theodore H. Smith" <email@hidden>
- Date: Fri, 23 Jul 2004 13:19:46 +0100
I have a question on mixing C and ObjC libraries.
I have a C library source code, which I compile, and some ObjC code
which calls the C library.
The C library is for a "dictionary". The ObjC code is a fractal
generator app. Now, I'm wondering, how does the memory management work
out in these situations?
Would an object leak? Or would an object be prematurely disposed? My C
library does a lot of bad things with typecasting, (as most C code
does), and I can't see how any compiler could keep track of what my
library does with the objects stored.
Of course, I am hoping to be pleasurably surprised by some ingenious
mechanism in ObjC which silently manages situations like this...
Perhaps when ObjC objects are passed to C code, it relinquishes all
sense of memory management on that object, and even doesn't increase
the object's refcount?
And perhaps when ObjC objects are returned from C code, it doesn't also
deal with the object's refcount? In that case, wouldn't I need to write
some kind of refcount dealing code into my C library?
--
Theodore H. Smith - Software Developer.
http://www.elfdata.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.