Over-VM Master Data: SQLite Cache Page

I will keep this question common for now and avoid cluttering this code.

I have an iOS application that uses Core Data ( sqlite ) for its data store. The model is quite complex, with a large hierarchy of objects. When I retrieve and import these large datasets, I notice that the application crashes after a while due to a memory warning.

The Allocations profiler shows me excessive "temporary" virtual machines: sqlite page objects. The size of it grows and grows, but NEVER falls. I tried to ensure that all of my NSManagedObjectContext stored inside executeBlock calls.

It seems to me that there are object contexts that are not freed and / or reset.

I tried to disable undoManager in NSManagedObjectContext . setting stalenessInterval to a very low value (1.0) and calling reset on my MOC after they are done while saving the data upon import.

What does it mean when the short-term cache file of the temporary sqlite VM continues to grow so high? What needs to be done to reduce page cache?
What is the acceptable size for this cache in a large Core Data application?

Thanks,

+5
source share
1 answer

Well, it turns out that briefly displaying the column column of the SQLite VM page cache in Tools is cumulative for the session, not the "current" value. Well of course he never sinks!

It turns out that some other optimizations around providing contexts for managed objects are cleared, eliminating the memory problem of CoreData.

Great article here on the topic: Problems with master data with memory allocation

0
source

Source: https://habr.com/ru/post/1245786/


All Articles