• 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: Core Data SIGSEGV when opening an existing document
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Core Data SIGSEGV when opening an existing document


  • Subject: Re: Core Data SIGSEGV when opening an existing document
  • From: mmalcolm crawford <email@hidden>
  • Date: Wed, 19 Apr 2006 22:20:27 -0700


On Apr 19, 2006, at 8:27 PM, Larry Fransson wrote:


On Apr 19, 2006, at 12:18 AM, mmalcolm crawford wrote:

Why not start with something simple like explicitly fetching all instances of all entities at startup (see "Batch Faulting..." <http://developer.apple.com/documentation/Cocoa/Conceptual/ CoreData/Articles/cdPerformance.html#//apple_ref/doc/uid/ TP40003468-SW3>)?

So I looked at that again, and tried to implement something that looks like it. It may or may not be working as advertised, because I'm still getting the crash.


Where should I be doing the prefetching and batch faulting? - windowControllerDidLoadNib: seems to be the only place I get any results.

You can only do it when the persistence stack has been initialised.

Any place else (I tried three other methods that are called before that, starting with -init), and the array count is 0. I've tried it both before and after calling super's implementation.

See <http://developer.apple.com/documentation/Cocoa/Conceptual/ NSPersistentDocumentTutorial/index.html>.


Here is the code I'm using for prefetching and batch faulting:

//Prefetch all entries
NSManagedObjectContext *moc = [self managedObjectContext];
NSEntityDescription *entryED = [NSEntityDescription entityForName:@"LogBookEntry" inManagedObjectContext:moc];
NSFetchRequest *entryFR = [[NSFetchRequest alloc] init] ;
[entryFR setEntity:entryED];
NSError *err = nil;
NSArray *entries = [moc executeFetchRequest:entryFR error:&err];
if(err) NSLog(@"Error fetching entries");

NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SELF IN %@", entries];
[entryFR setPredicate:predicate];
err = nil;
entries = [moc executeFetchRequest:entryFR error:&err];
if(err) NSLog(@"Error prefetching entries");
NSLog(@"fetched %i entries", [entries count]);
[entryFR release];


Does this look about right?

No. All you're doing here is fetching a collection of objects, then fetching exactly the same set again.


I get an array of 2800+ objects returned, which is good. I can't tell if the batch fault works or not, because calling -isFault on the returned objects returns YES.

<http://developer.apple.com/documentation/Cocoa/Reference/ CoreData_ObjC/Classes/NSManagedObject.html#//apple_ref/occ/instm/ NSManagedObject/isFault>
and
<http://developer.apple.com/documentation/Cocoa/Conceptual/CoreData/ Articles/cdFaultingUniquing.html#//apple_ref/doc/uid/ TP30001202-185436-TPXREF147>



And in any case, I'm still getting the SIGSEGV, which doesn't happen when I open the document with just 500 objects.

Is the document corrupted?

mmalc

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Core Data SIGSEGV when opening an existing document
      • From: Larry Fransson <email@hidden>
    • Re: Core Data SIGSEGV when opening an existing document
      • From: Larry Fransson <email@hidden>
References: 
 >Core Data SIGSEGV when opening an existing document (From: Larry Fransson <email@hidden>)
 >Re: Core Data SIGSEGV when opening an existing document (From: mmalcolm crawford <email@hidden>)
 >Re: Core Data SIGSEGV when opening an existing document (From: Larry Fransson <email@hidden>)

  • Prev by Date: Re: Saving Issue with Core Data
  • Next by Date: Re: memory leak in readInBackgroundAndNotify
  • Previous by thread: Re: Core Data SIGSEGV when opening an existing document
  • Next by thread: Re: Core Data SIGSEGV when opening an existing document
  • Index(es):
    • Date
    • Thread