如何清除充满表情字符的字体缓存? [英] How to clear font cache filled with emoji characters?

查看:592
本文介绍了如何清除充满表情字符的字体缓存?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发iPhone的键盘扩展。有一个表情符号屏幕与苹果自己的表情符号键盘相似,在 UICollectionView 中显示了大约800个表情符号字符。



emoji UIScrollView 会滚动内存使用量增加,不会下降。我正在重复使用单元格,当单个表情符号显示800倍时,内存在滚动过程中不会增加。

代码,但似乎表情符号被缓存,并可能需要大约10-30MB的内存,取决于字体大小(研究表明,他们实际上是PNG)。键盘扩展可以使用少量内存,然后才能杀死。有没有办法清除该字体缓存?




编辑



添加代码示例来重现问题:

  let data = Array(

I am developing keyboard extension for iPhone. There is an emoji screen smilar to Apples own emoji keyboard that shows some 800 emoji characters in UICollectionView.

When this emoji UIScrollView is scrolled the memory usage increases and does not drop down. I am reusing cells correctly and when testing with single emoji character displayed 800 times the memory does not increase during scrolling.

Using instruments I found that there is no memory leak in my code but it seems that the emoji glyphs are cached and can take around 10-30MB of memory depending on font size (reseach shows they are actually PNGs). Keyboard extensions can use little memory before they are killed. Is there a way to clear that font cache?


Edit

Adding code example to reproduce the problem:

let data = Array("
                        

这篇关于如何清除充满表情字符的字体缓存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆