CGPDFDocumentCreateWithURL 内存使用情况
大家好,我来这里是为了澄清我的疑问,这对大多数人来说可能很愚蠢,但我的应用程序需要它。我的问题是在编写以下行 CGPDFDocumentRef myDocumentRef= CGPDFDocumentCreateWithURL(pdfUrl); 时需要多少内存,就像 pdf 大小或任何其他大小一样。当然,我正在使用 CGPDFDocumentRelease(myDocumentRef) 释放 CGPDFDocumentRef。任何人都可以告诉我 CGPDFDocumentRef 可以使用多少内存吗?提前致谢。
Hi every one i am here to clarify my doubt it might be silly for most of them but i need it for my app.my question is while writing the below line CGPDFDocumentRef myDocumentRef= CGPDFDocumentCreateWithURL(pdfUrl); how much memory will it take like what ever the size of the pdf size or any other.Of course i am releasing the CGPDFDocumentRef using CGPDFDocumentRelease(myDocumentRef). Can any one please give an idea how much memory CGPDFDocumentRef can it use.Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
文件大小与 CGPDFDocument 消耗的内存量关系不大。对 CGPDFDocumentCreateWithURL 的调用实际上会分配很少的内存,因为它只是读取一些元数据(文档标题、页数...)。
当您实际对文档执行某些操作(例如渲染页面)时,您会看到内存使用量增加,因为所有图像、字体等都必须从文件加载到内存中。然而,这并不直接取决于文件大小,因为文档(或其中的一部分)可能被压缩,某些资源可能由多个页面共享等。
The file size has very little to do with how much memory
CGPDFDocument
consumes. The call toCGPDFDocumentCreateWithURL
will actually allocate very little memory because it's just reading some metadata (title of the document, number of pages...).You will see the memory usage increase when you actually do something with the document, like rendering a page, because then all the images, fonts, etc. have to be loaded from the file into memory. This does not however depend directly on the file size because the document (or just parts of it) might be compressed, some resources could be shared by multiple pages, etc.