简体   繁体   English

iOS CGContextDrawPDFPage内存不是线程安全的

[英]iOS CGContextDrawPDFPage memory not thread safe

When i draw a PDF i saw from instruments that if the CGContextDrawPDFPage method is not called from main thread, creates a leak in memory. 当我绘制PDF时,我从仪器中看到,如果未从主线程调用CGContextDrawPDFPage方法,则会在内存中造成泄漏。

Someone has encountered the same problem? 有人遇到过同样的问题吗?

Any help is appreciated. 任何帮助表示赞赏。

It's been a while, but I recall that the PDF functions involved a fair amount of lazy instantiation or caching. 已经有一段时间了,但是我记得PDF函数涉及大量的惰性实例化或缓存。 Is Instruments showing a true leak, or just allocations that don't go away? 工具显示的是真正的泄漏,还是分配不会消失?

I remember getting concerned about memory bloat, until I realized it went away when I released the higher-level objects (CGPDFDocumentRef, I think). 我记得我曾担心内存膨胀,直到意识到释放高级对象(我认为是CGPDFDocumentRef)后,内存膨胀就消失了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM