• 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: Objective-C Garbage Collection problems
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Objective-C Garbage Collection problems


  • Subject: Re: Objective-C Garbage Collection problems
  • From: Clark Cox <email@hidden>
  • Date: Tue, 9 Mar 2010 11:19:21 -0800

On Tue, Mar 9, 2010 at 11:08 AM, Josh de Lioncourt
<email@hidden> wrote:
>
> OK, here is the part that I'm still sticking on. First, you wrote:
>
> On Mar 8, 2010, at 6:25 PM, Quincey Morris wrote:
>
>> On Mar 8, 2010, at 16:01, Josh de Lioncourt wrote:
>>
>> Therefore, if the framework isn't coded for GC compatibility, it's likely going to be unusable at runtime in a GC app, no matter how you set the build settings.
>>
>> Was the framework written with code for both GC and non-GC environments?
>>
> From Apple's docs, it seems that setting the build setting to "Supported" rather than "Required", should allow the framework to either manage its own objects, or have them collected.

If the build setting is set to Supported, then the framework *must*
support both methods of operation. (i.e. it's not up to the framework,
it's up to the application that loads the framework).

> What do you mean by "coded" for GC? If there are specific things that need to be changed to use even the "supported" setting, I cannot find specific information on what these would be, or what to look for to try to eliminate the problems in the source. I've already recompiled the framework with GC supported, but there's obviously more than must be done to truly make this work, and the docs have not been helpful.
>
> The only thing I can think of, as of now, is perhaps, once the framework is compiled with GC supported, the GC, at run time, is not finding any "strong" references to the objects created by the framework, and destroying them as fast as they are created. If that is the case, I have no idea how to rectify that in the framework's source.

You need to go through your framework's code and find any places where
the Obj-C reference count is the only thing keeping an object alive
(i.e. any place where you don't have a strong pointer to that object),
as there *is no Obj-C reference count* when running in a garbage
collected process, and such an object will be collected. For instance,
this frequently happens in places where you register for a callback,
and pass some object through a (void*)context parameter.

You may want to read through the Garbage Collection Programming Guide:
<http://developer.apple.com/Mac/library/documentation/Cocoa/Conceptual/GarbageCollection/Introduction.html>


--
Clark S. Cox III
email@hidden
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Objective-C Garbage Collection problems (From: Josh de Lioncourt <email@hidden>)
 >Re: Objective-C Garbage Collection problems (From: Quincey Morris <email@hidden>)
 >Re: Objective-C Garbage Collection problems (From: Josh de Lioncourt <email@hidden>)

  • Prev by Date: Re: NSTextView attachments and context menus
  • Next by Date: Re: Question Re Memory Management in Apps
  • Previous by thread: Re: Objective-C Garbage Collection problems
  • Next by thread: Using Core Data in Command Line utility
  • Index(es):
    • Date
    • Thread