开发者

In a GC environment, when will Core Data release its allocated memory?

In my application, right now it seems that Core Data is busy allocating space in memory for different objects, however, it's never releasing that memory. The memory used by the application keeps growing the more it runs.

Is there a call to the Core Data context (or something else) that ensures all memory is cleaned up? When will Core Data 开发者_如何学运维release the allocated memory?

Thanks!


Even when core data has finished with an object (which might not be when you think), the garbage collector won't necessarily collect it straight away.

The garbage collector has two methods to trigger collection: collectIfNeeded and collectExhaustively. The former doesn't guarantee to collect right now and the latter will probably stop your application for a bit.

You can force core data to fault its objects. See Reducing Memory Overhead for details.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜