English 中文(简体)
短片用于信片开发
原标题:Strange thing in memory management for ios development

我ip。

1. 导言 开放记忆和看望记忆工具(积极监测),第8.95M节

2.click a button, it will Add a UIImage 视屏上的巨大形象,现在的记忆为17.8M。

3. 。 移走UIImage 从屏幕上看,到第二次,记忆为9.09M。

I am sure the UIImageView is released after it removed from screen. That s very simple code. So when it removed, the status of the app should as the same as before add the UIImageView add to the screen, am I right? But why the memory is 9.09M rather than 8.95M? If you add a more complex View to the screen, the difference is more obvious.

问题回答

这是正常的。 这是由于“拉齐生长、 la缩”算法。 这意味着,你有一个数据结构,可用于少量项目或大量项目。 少量物品的充斥使用很少的记忆,但在处理大量物品时效率不高。 大量人口在管理大量物品方面非常有效率,但利用更多的记忆对物体进行索引。

一种“拉齐增长、 la缩”算法试图避免结构指数的重新调整成本,如果指数太小,而如果它过于庞大,则只缩小了。 例如,只有在理想规模大于理想规模的三倍时,典型算法才可能增长指数。 如果申请迅速分配和免费收集资源,还需要防止大量转售业务——你希望指数规模成为比值。

When you open the large object and consume GUI objects, you make the index much too small, and it grows. But when you close the large object, you make the index only a bit too big, so it doesn t shrink.

如果装置受到记忆压力,该指数将缩小。 如果申请继续减少其使用统一制度资源的情况,指数就会缩小。 如果申请使用更多的国库资源,那么指数就不必很快再增长。

一种很好的类比可能是在你的桌子上打纸。 如果你需要找到30份文件,你可能会把这些文件保留在4个座椅上。 但是,如果你有5 000份论文,4个座椅子就会使搜索变得ious。 在该案中,你需要有更多的障碍。 因此,当文件数量对4个摇篮来说太大时,你需要将文件重新编号为更多的摇篮。 但是,在人数少的时候,你们赢得了不断重指数的双手,直到你走过太多的摇篮,因为搜索速度仍然相当快。

当你重新处理所有这些文件时,你的桌子有一些额外的障碍。 这使委员会无法在今后处理许多文件时重新确定其索引。





相关问题
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, ...

热门标签