iPhone字体缓存
有谁知道 iPhone 是否保留了以前使用过的字体字符的缓存?
最近,在尝试发现 UITextField 控制器附近的内存泄漏时,我注意到每当我开始编写仅使用之前尝试的字符的文本时,泄漏几乎(95%)消失了。
似乎发生的情况是,对于字体中的每个显示字符,系统都会在第一次显示时将其存储在内存中,并在重复时重用它。
但是我在互联网上找不到任何关于此行为的帖子/文章。
Does anybody know if the iPhone maintains a cache of previously used font characters?
Recently, while trying to uncover a memory leak near a UITextField controler, I've noticed that the leaks are almost (95%) gone whenever I start writing text that uses only characters from previous attempts.
What seems to happen is that for every displayed character from a font, the system stores it in memory the first time it's displayed and reuses it when it's repeated.
However I couldn't find any posts/articles on the Internet about this behaviour.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
UIKit 在元数据和字形级别缓存字体,以防止重复解析字体数据。不过,相对于应用程序的其余部分,它应该使用微不足道的内存量(除非您尝试从每种字体中绘制每个字形)
UIKit caches fonts at the metadata and glyph level to prevent parsing font data repeatedly. It should use an insignificant amount of memory relative to the rest of your application though (unless you attempt to draw every glyph from every font)