FROM : Ben Trumbull
DATE : Sun Nov 04 01:26:05 2007
> Okay, so for completeness, i thought i'd share the resolution of this
> with the list, in case someone finds this thread in the future.
>
> I set the app up to create small batches of ManagedObjects (several
> hundred at a time) and added a small pause (0.01 sec.) between batches
> via a delayed selector.
You shouldn't need a pause, and you should have good results with
batches in the thousands.
> Before creating any ManagedObjects, i cancelled undo registration.
>
> Once a batch was created, i processed pending changes, saved, and
> reset the managedObjectContext.
> incidentally, resetting appears to create a brand new undo manager
> for the context, so i disabled each time; there was no need to re-
> enable when done.
To disable the undo manager on NSManagedObjectContext, set it to nil.
-reset does not recreate an undo manager.
> Using an autorelease pool for each batch worked well, keeping memory
> use extremely low.
>
> Using garbage collection resulted in a significant memory gain, but
> nowhere near bad enough to crash the program. Oddly, the memory use
> did not subside after the loop had finished.
How did you measure that ? 'heap' will provide more useful
information than 'top'
- Ben
DATE : Sun Nov 04 01:26:05 2007
> Okay, so for completeness, i thought i'd share the resolution of this
> with the list, in case someone finds this thread in the future.
>
> I set the app up to create small batches of ManagedObjects (several
> hundred at a time) and added a small pause (0.01 sec.) between batches
> via a delayed selector.
You shouldn't need a pause, and you should have good results with
batches in the thousands.
> Before creating any ManagedObjects, i cancelled undo registration.
>
> Once a batch was created, i processed pending changes, saved, and
> reset the managedObjectContext.
> incidentally, resetting appears to create a brand new undo manager
> for the context, so i disabled each time; there was no need to re-
> enable when done.
To disable the undo manager on NSManagedObjectContext, set it to nil.
-reset does not recreate an undo manager.
> Using an autorelease pool for each batch worked well, keeping memory
> use extremely low.
>
> Using garbage collection resulted in a significant memory gain, but
> nowhere near bad enough to crash the program. Oddly, the memory use
> did not subside after the loop had finished.
How did you measure that ? 'heap' will provide more useful
information than 'top'
- Ben
| Related mails | Author | Date |
|---|---|---|
| John R.Timmer | Oct 30, 22:03 | |
| Bill Bumgarner | Oct 30, 22:56 | |
| John R. Timmer | Oct 31, 13:37 | |
| Bill Bumgarner | Oct 31, 16:31 | |
| Ben Trumbull | Nov 1, 03:41 | |
| John R. Timmer | Nov 2, 20:01 | |
| Ben Trumbull | Nov 4, 01:26 | |
| Chris Hanson | Nov 4, 02:59 | |
| John R. Timmer | Nov 4, 05:06 |






Cocoa mail archive

