We're running into a situation where Core Data is making very large memory allocations when faulting in small amounts of data.

The entity has:
  - 2x Date
  - Int16
  - 4x Int32
  - Boolean
  - String
  - to-one relationship
  - String (in a subentity)
  - to-one relationship (in a subentity)
  - to-many relationship (in another subentity)

The row in the SQLite database matches this structure, there's nothing unexpected there. And a database that contains about 8000 of them is a sum total of 1.1MB.

But when these are faulted in, according to Instruments, Core Data allocates a GeneralBlock-528384 per record! Even if you naively preallocated a good chunk of memory for the strings, I can't imagine using more than 1-2KB per record, so 516KB is totally ridiculous.

The stack trace is:
   5 <our code>
   4 CoreData -[_NSFaultingMutableSet objectEnumerator]
   3 CoreData -[_NSFaultingMutableSet willRead]
2 CoreData -[NSManagedObjectContext(_NSInternalAdditions) _retainedObjectWithID:optionalHandler:withInlineStorage:] 1 CoreData + [NSManagedObject(_PFDynamicAccessorsAndPropertySupport) allocWithEntity:]
   0 CoreData _PFAllocateObject

I've checked instance variables in the NSManagedObject subclasses in case something silly was happening there, but with no luck. The class for these rows has a BOOL and 5 pointers, inheriting from a class with no ivars, inheriting from NSManagedObject.

Any ideas/suggestions?

Thanks,
Benjamin Rister
_______________________________________________

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