Garbage collection, core data, and tight loops
Garbage collection, core data, and tight loops
- Subject: Garbage collection, core data, and tight loops
- From: John R.Timmer <email@hidden>
- Date: Tue, 30 Oct 2007 17:03:06 -0400
Greetings -
I'm trying to process an enormous XML file that should ultimately fill
a Core Data sqlite store with millions of records. This should only
happen once, so i'm willing to let the app go non-responsive; i'm
doing all the parsing in an extremely tight loop. My first time
through, i did things with manual memory management, but the memory
use kept going up. So, i switched to mandatory Garbage Collection,
leaving my autorelease pool statements in place, since they should be
converted to no-ops. I confirmed that a collector thread existed when
i launched the app.
It still ran out of memory:
malloc: *** auto malloc[333]: Zone::Can not allocate 0x8200000 bytes
I'm assuming the problem is an interaction between the tight loop and
either Core Data or the Garbage Collector:
The GC doesn't recognize which objects to collect while the loop is
still chugging away.
The sqlite store can't send objects out to disk and release their
memory while the loop is still chugging away.
I'm leaning towards the latter explanation.
I'm going to redesign things so that the main runloop has a chance to
act sporadically, but i was just curious as to which of these is a
problem so that i can design specifically to avoid this in the future.
Thanks,
John
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden