cocoa - Core Data is using a lot of memory -


I have a data model that is like this simplified drawing:

This is a bit weird, but the idea is that the app manages multiple accounts / identities that a person can have in a message system. Each account is associated with a user on the system, and each message can potentially be seen / sent to multiple accounts (but they have a unique unique ID, so Message ID property to use to bring message objects Which can be pre-downloaded and imported by a previous session).

The app is used from the per-account point view - What do I mean if you choose which account you want to use, you can see the messages and the stuff your account See from the standpoint of that account, so I have messages related to the account, so that I can easily get such messages which should be shown using FEET in this way:

  fetch.fetchPredicate = [NSPredicate predicateWithFormat: @ "% @ IN accounts", d Acneet]; Fetch.sortDescriptors = [NSArray arrayWithObject: [[NSSortDescriptor alloc] initWithKey: @ "Date" ascending: No]]; Fetch.fetchLimit = 20;  

It sets correctly the messages that are shared between messages and if the message is read as one, then I want it to be second Being taught by and so on.

However, after all this setup, the big problem is that memory usage seems a little crazy. When I set up a test case where it imports hundreds of messages in the system, and from time to time to recover (using the above mentioned fat) and showing them in a list (list only the last 20 ), The memory just goes crazy. 60 MB .. 70 MB ... 100 MB .. etc.

I tracked many relationships between account and message, even with garbage collection, managed objects are still being strongly referenced by the accounting properties of the account. This is known because I put a log in the final form of the example of my message and never see it - but if I reset or refresh from time to time: merge onto the object: the account's On the object, I see message and memory usage in the final form very consistent although it is still growing somewhat, but I am importing goods, hopefully to be expected). The problem is that I can not actually reset the reference or account object all the time because it actually spoils the observer who is looking at other features of the account object!

I can only model it incorrectly or think it wrong, but I continue to read that core data as an object graph is not important and the database is not me It seems that I have done here, but this is causing the problem. What should I do?

Use the Object Graph Tool I will tell you ownership to keep an object alive.


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -