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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to