• 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
Garbage Collection and NSManagedObject
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Garbage Collection and NSManagedObject


  • Subject: Garbage Collection and NSManagedObject
  • From: Samuel Strupp <email@hidden>
  • Date: Thu, 12 Feb 2009 15:52:24 +0100

Hi guys

i have problem with the garbage collector. May App is a CoreData App (not document based). If i try to change the database and load a new one. The grabage collector collects the old NSMangedObjects from the old store. But this happens in the gabage collector thread. The mainThread is executing, too. So some of the managed objects will be finalized after the deletion of the database. This results in an exception like this:

GC: -finalize resulted in an exception (0x1477cd0) being thrown, break on objc_exception_during_finalize_error to debug
The NSManagedObject with ID:XXX <XXX> has been invalidated.



The main problem is that such objects seems to get observer messages and then they will hang up the app if they try to access there parameters from the store.


One solution would be to perform the gabage collection in the main thread. But I don't know how.
Another solution should be to wait for the gabage collector until it is finished with somethig stupid like this:


while ([[NSGarbageCollector defaultCollector] isCollecting]) {
		[NSThread sleepForTimeInterval:0.5];
}

But this hangs up the app, too. I don't know why!

So has somebody a solution or idea for this garbage collector problem?

Thanks & Regrads
Samuel Strupp
_______________________________________________

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 and NSManagedObject
      • From: "I. Savant" <email@hidden>
  • Prev by Date: Re: Saving a PDF Selection or converting it to an NSRange and back
  • Next by Date: Saving IKImageBrowser Order and Content?
  • Previous by thread: Re: Reading packets from an audio file
  • Next by thread: Re: Garbage Collection and NSManagedObject
  • Index(es):
    • Date
    • Thread