Re: NSEntityDescription random crash
Thank you - I have tried enabling NSZombie and it seems the object being freed is my managedObjectModel. I really can't figure out why the MOM instance is being deallocated. I don't have a lot of code to post since I'm using the standard Xcode- generated code for non-duc based CoreData apps. (An app delegate, instantiated in the MainMenu nib, and a bunch of accessors to get the persistent store coordinator, MOM and MOC the first time someone asks for them). I enabled MallocStackLogging and looked up that xxx address with malloc_history pid xxx, and here's what the trace looks like: = Call [2] [arg=36]: thread_a00e2fa0 |start | main | NSApplicationMain | +[NSBundle(NSNibLoading) loadNibNamed:owner:] | + [NSBundle(NSNibLoading) loadNibFile:externalNameTable:withZone:] | + [NSBundle(NSNibLoading) _loadNibFile:nameTable:withZone:ownerBundle:] | loadNib | -[NSIBObjectData nibInstantiateWithOwner:topLevelObjects:] | -[NSNibBindingConnector establishConnection] | - [NSObject(NSKeyValueBindingCreation) bind:toObject:withKeyPath:options:] | -[NSBinder _performConnectionEstablishedRefresh] | -[NSObjectParameterBinder _observeValueForKeyPath:ofObject:context:] | -[NSObjectParameterBinder _updateObject:observedController:observedKeyPath:context:] | - [NSBinder valueForBinding:resolveMarkersToPlaceholders:] | -[NSBinder _valueForKeyPath:ofObject:mode:raisesForNotApplicableKeys:] | - [NSObject(NSKeyValueCoding) valueForKeyPath:] | - [NSObject(NSKeyValueCoding) valueForKey:] | -[AppDelegate managedObjectContext] | -[AppDelegate persistentStoreCoordinator] | - [AppDelegate managedObjectModel] | +[NSManagedObjectModel mergedModelFromBundles:] | -[NSManagedObjectModel initWithContentsOfURL:] | +[NSKeyedUnarchiver unarchiveObjectWithFile:] | _decodeObject | _decodeObjectBinary | + [NSObject allocWithZone:] | _internal_class_createInstance | _internal_class_createInstanceFromZone | calloc | malloc_zone_calloc Call [4] [arg=0]: thread_b013e000 |thread_start | _pthread_start | minion_duties2 | CFRelease | -[_PFTask dealloc] | malloc_zone_free Call [2] [arg=48]: thread_b013e000 |thread_start | _pthread_start | minion_duties2 | CFRelease | -[_PFTask dealloc] | NSDeallocateObject | objc_duplicateClass | calloc | malloc_zone_calloc = Any thoughts as to what minion_duties2 or PFTask is? I am not the one creating background threads in the app, so I take it thread_b013e000 is Cocoa/CoreData's doing. If the problem comes from my nib and bindings, is there a way to debug that? Thanks! Nicolas On Jul 10, 2008, at 5:54 PM, Shawn Erickson wrote: On Thu, Jul 10, 2008 at 6:56 AM, Nicolas Lapomarda [EMAIL PROTECTED] wrote: The error I'm getting is random as well, but always takes the form *** -[NSCFString _entityForName]: unrecognized selector sent to instance xxx. You likely are not retaining an object that you expect to stay around. This results in that object getting deallocated and some other random object dropping in at that address in memory. You can enable NSZombie to help track down this issue. http://developer.apple.com/technotes/tn2004/ tn2124.html#SECFOUNDATION -Shawn ___ 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 [EMAIL PROTECTED]
NSEntityDescription random crash
Soon after the main nib has been loaded, I need to execute a fetch request. Now as the title says, the crash is random: sometimes the app executes just fine, sometimes it crashes. When it does crash, here is where it happens: [NSEntityDescription entityForName:anEntityName inManagedObjectContext:managedObjectContext] The error I'm getting is random as well, but always takes the form *** -[NSCFString _entityForName]: unrecognized selector sent to instance xxx. What changes launch after launch is the name of the class I'm supposedly sending the message to. I've seen NSCFString, NSCFArray, _NSPlaceholderTextFieldPlugin and other exotic class names... I've also tried getting the entity description with the equivalent code below... NSManagedObjectModel *managedObjectModel = [[managedObjectContext persistentStoreCoordinator] managedObjectModel]; NSEntityDescription *entity = [[managedObjectModel entitiesByName] objectForKey:anEntityName]; ... but the equivalent problem occurs (*** -[NSCFString entitiesByName]: unrecognized selector sent to instance xxx). The code above is executed in a method called from -awakeFromNib. As the nib file contains tree / array controllers that query the same managedObjectContext, I've tried delaying the execution of my method using performSelector:withObject:afterDelay: but it didn't seem to help. Is NSEntityDescription acting crazy or am I? Nick ___ 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 [EMAIL PROTECTED]
Re: NSEntityDescription random crash
Is NSEntityDescription acting crazy or am I? This is almost certainly a memory management error on your part, but it's impossible to say for sure because: 1 - You did not provide a code listing that demonstrates: a) where the pertinent objects are being declared/created*. b) the context in which they are being used*. 2 - What the actual crash is (the signal you receive on crash). For a good example of what to provide when posting a programming question to a technical list, give this a read: http://www.catb.org/~esr/faqs/smart-questions.html -- I.S. * Otherwise known as POST YOUR CODE. ___ 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 [EMAIL PROTECTED]
Re: NSEntityDescription random crash
On Thu, Jul 10, 2008 at 6:56 AM, Nicolas Lapomarda [EMAIL PROTECTED] wrote: The error I'm getting is random as well, but always takes the form *** -[NSCFString _entityForName]: unrecognized selector sent to instance xxx. You likely are not retaining an object that you expect to stay around. This results in that object getting deallocated and some other random object dropping in at that address in memory. You can enable NSZombie to help track down this issue. http://developer.apple.com/technotes/tn2004/tn2124.html#SECFOUNDATION -Shawn ___ 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 [EMAIL PROTECTED]