• 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: Garbage collection problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Garbage collection problem


  • Subject: Re: Garbage collection problem
  • From: "Clark S. Cox III" <email@hidden>
  • Date: Wed, 9 Jan 2008 05:54:13 -0800



Clark Cox III
email@hidden
Sent from my iPhone

On Jan 9, 2008, at 5:24, Dent John <email@hidden> wrote:

Hi Jonathon,

So, thanks for the quick response there.

The object in question is instantiated in my NIB and, though is not visible, it has outlets to other objects (specifically an array controller and a spinning circle thing). I figured that would be strong enough to prevent collection.

That is not enough. The object needs pointers pointing *to* it in order to be kept around.




Also, the self is obviously stored in SyncServices as it knows that it's a callback-able class for when of tries to client:mightWantToSyncEntityNames:.

If the syncservices docs claim to retain the object, then I'd file a bug. Otherwise, you cannot assume that it will keep your object around.




I implemented the finalize method just now and, sure enough, the object is getting collected.

I'll try making the object pop itself into a global to see if it helps.

d.
--
Sent from my iPhone

On 9 Jan 2008, at 11:57, Jonathon Mah <email@hidden> wrote:

Hi,

On 2008-01-09, at 21:15, Dent John wrote:

For example, in a classes init method, I get it to NSLog the self pointer. Then, after some time, I see errors relating to the class.


Are you storing a reference to that instance in a "strong" location, such as a global variable? Otherwise the garbage collector has no idea that it might be used later on.



Jonathon Mah
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
_______________________________________________

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
_______________________________________________

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


  • Follow-Ups:
    • Re: Garbage collection problem
      • From: Dent John <email@hidden>
References: 
 >Garbage collection problem (From: Dent John <email@hidden>)
 >Re: Garbage collection problem (From: Jonathon Mah <email@hidden>)
 >Re: Garbage collection problem (From: Dent John <email@hidden>)

  • Prev by Date: Re: Non-AppKit equivalent for NSWorkspace and/or future-proof poseAsClass?
  • Next by Date: Re: Trapping user shutdown/logout/restart in Cocoa/Foundation tool
  • Previous by thread: Re: Garbage collection problem
  • Next by thread: Re: Garbage collection problem
  • Index(es):
    • Date
    • Thread