解决 iPhone/iPad 内存不足问题
我遇到一个奇怪的问题,我正在滚动分页 UIScrollView,它显示 PDF 文档的页面(使用 Quartz 2D 和 CATiledLayer)。当我对内存分配进行分页时,它看起来很好,它上升了几个初始页面,然后保持稳定,因为它显然释放了为早期页面保留的内存。当点击第 x 页(不是某个 PDF 页面或某个数字本身)时,内存使用量从几兆增加到 308 兆,并且应用程序崩溃。
所以我的问题是:如何最好地找出造成这种情况的原因? Instruments 中的对象分配工具将内存显示为简单地进行 malloc。 (大块)。
I have a strange issue where I'm scrolling through a paged UIScrollView which displays the pages of a PDF document (using Quartz 2D and CATiledLayer). When I page through memory allocation looks fine with it going up with a few initial pages and then keeping it steady as it obviously releases the memory kept for earlier pages. Upon hitting page x (not a certain PDF page or a certain number per se) memory usage goes from a couple of megs to 308 megs and the app crashes.
So my question is: how to best try to find what's causing this? The object alloc tool in instruments shows the memory as simply going to malloc. (in huge chunks).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是一个老问题,但我已经解决了这个问题,所以为什么不发布它......
事实证明,罪魁祸首是 PDF 中的某种嵌入(矢量)艺术品。这种情况会发生在几个不同的打印 PDF 上。 CGPDF 等人简直疯了。唯一的解决方法是使用适当的 PDF 制作工具对所述图稿进行实际光栅化。
This is an old question but I've since figured out the problem so why not post it...
Turns out the culprit was a certain kind of embedded (vector) artwork inside the PDF. This would happen on several different print PDF-s. CGPDF et al just went nuts. The only workaround was to actually rasterize said artwork with the appropriate PDF production tools.