English 中文(简体)
采用核心数据对流体内无明显/明显――意见的记忆影响?
原标题:Memory footprint benefits of using CoreData vs in-memory not evident/obvious - opinions?

I have an app that currently holds all state in memory. It fetches a bunch of information from a server as JSON and then holds on to the JSON values in memory. Each JSONObject can be ~300 bytes and there can be thousands of such objects. I use this data simply to populate UITableView.

In order to better handle large amounts of aata, I modified my code to fetch data from the server and store it using CoreData. There JSON objects can be represented as simple entities, each with 3 NSString attributes and one 1 int32 attribute. I created a NSFetchedResultsController to use as the data source of the UITableView. My assumption was that this would reduce the resident memory usage of my application (I assume NSFetchedResults controllers effectively manages memory to not hold entities that aren t being displayed in the view, vs holding all my state in-memory). For the purposes of this discussion, let s assume my app purges the CoreData store and re-fetches all data each time it runs.

当我用仪器跟踪器衡量居民记忆和虚拟规模的变化时,我注意到这两个数值几乎相同。 事实是,我用核心数据表示的记忆似乎比我完全掌握本底时多。

While this may be true, I don t have an intuition for why this might be so. Any explanations? From what I have said about my app, does it sound like I don t want to bother persisting in CoreData, and why?

最佳回答

如果有记忆,核心数据可以像你所看到的那样使用更多的记忆。 然而,核心数据的一个好处是,当你陷入低记忆状态。 如果发生这种情况,核心数据将尽可能自动减少自己的记忆足迹。

还有一点需要考虑,是你让核心数据错失这些物体? 如果你拿到1000件物品,显示其中10件,则其他990件应当处于破碎状态,因此,记忆却较少。

我将利用核心数据工具,确保你不会因事故和无意造成你的记忆使用高于需要而完全实现所有这些目标。

Update

象你这样的声音是输入这一数据,如果你不看到任何错失,则不会适当抽取核心数据。

假设你在第一次发射上装上这一数据(我不会这样做,我将在装上该笔数据并完全避免列入清单的文档),在装满后,你希望将<代码>-reset<>>>>>>>>---reset上。 然后,随着数据重现(在使用时)数据,数据就会被适当错。

最后,确保你使用一个宝库。 否则,这是空洞的。

问题回答

暂无回答




相关问题
List Contents of Directory in a UITableView

I am trying to list the contents of Ringtones directory in a TableView, however, I am only getting the last file in the directory in ALL cells, instead of file per cell. This is my code: - (...

iPhone NSUserDefaults persistance difficulty

In my app i have a bunch of data i store in the NSUserdefaults. This information consists of an NSObject (Object1) with NSStrings and NSNumbers and also 2 instances of yet another object (Object2). ...

Writing a masked image to disk as a PNG file

Basically I m downloading images off of a webserver and then caching them to the disk, but before I do so I want to mask them. I m using the masking code everyone seems to point at which can be found ...

Resize UIImage with aspect ratio?

I m using this code to resize an image on the iPhone: CGRect screenRect = CGRectMake(0, 0, 320.0, 480.0); UIGraphicsBeginImageContext(screenRect.size); [value drawInRect:screenRect blendMode:...

Allowing interaction with a UIView under another UIView

Is there a simple way of allowing interaction with a button in a UIView that lies under another UIView - where there are no actual objects from the top UIView on top of the button? For instance, ...

热门标签