• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Memory management, when mixing C and ObjC
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Memory management, when mixing C and ObjC


  • Subject: Re: Memory management, when mixing C and ObjC
  • From: Dominik Pich <email@hidden>
  • Date: Fri, 23 Jul 2004 15:01:02 +0200

I dont see the problem... What has casting in C to do with ObjectiveC's memory management?
RefCount is RefCount and that is all that counts
Of course you need to retain/release and have an autorelase pool.

Regards,
Dominik

On Jul 23, 2004, at 2:19 PM, Theodore H. Smith wrote:

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.
_______________________________________________
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.


  • Follow-Ups:
    • Re: Memory management, when mixing C and ObjC
      • From: "Theodore H. Smith" <email@hidden>
References: 
 >Memory management, when mixing C and ObjC (From: "Theodore H. Smith" <email@hidden>)

  • Prev by Date: Re: NSSpeechSynthesizer and Volume
  • Next by Date: Re: Memory management, when mixing C and ObjC
  • Previous by thread: Memory management, when mixing C and ObjC
  • Next by thread: Re: Memory management, when mixing C and ObjC
  • Index(es):
    • Date
    • Thread