Skip navigation.
 
mlLocating managed objects within ObjectAlloc (was Re: Garbage collection, core data, and tight loops)
FROM : ajb.lists
DATE : Sat Nov 03 16:41:46 2007

On Nov 2, 2007, at 3:01 PM, John R. Timmer wrote:

> 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.


This sounds like caching behavior that I think I've observed.  My app 
create millions of managed objects during an import process, and I've 
seen large memory usage that doesn't go down when the objects are 
dealloced.  Looking at backtraces in ObjectAlloc, I see a lot of 
mallocs in caching functions as various objects are dealloc'ed.  If I 
close the NSPersistentDocument, I get some memory reclaimed, but not 
what I expect.  But, if I repeated run the import (without quitting), 
the peak memory doesn't go up, so the memory is apparently reused.

This leads me to a question about using ObjectAlloc (in Instruments on 
Leopard) effectively, especially with respect to Core Data.  When 
looking at allocations, there are a large number of GeneralBlocks of 
various sizes, but no NSManagedObjects.  I have some custom 
subclasses, too, and those aren't identified either in the Categories 
column.  I want to observe the usage patterns of the various entities 
in my model, but I'm not sure how to do that.  Is there an easy way to 
filter managed objects?

Thanks,

----
Aaron Burghardt
<email_removed>