作者:再见看淡_266 | 来源:互联网 | 2023-08-27 17:31
Myappisdownloadingbase64encodedcontent,inmostcasesPDFdocuments.Itistransferredviaweb
My app is downloading base64 encoded content, in most cases PDF documents. It is transferred via web service and wrapped up in SOAP. The documents can reach sizes of up to 100 MB.
我的应用程序正在下载base64编码的内容,大多数情况下是PDF文档。它通过web服务传输,并包在SOAP中。这些文档的大小可以达到100 MB。
To store these files locally, I need to extract them from the SOAP envelop, decode the base64 string and write to storage.
要在本地存储这些文件,我需要从SOAP信封中提取它们,解码base64字符串并将其写入存储。
Problem is, that a document of about 1 MB increases the temporary memory usage by 20-30 MB. When tracking allocations in Instruments, I can see those peaks. This isn't so much a problem. But a document of 60 MB increases memory by around 800 MB, and that's definitely too much for iOS devices.
问题是,一个大约1 MB的文档会增加20-30 MB的临时内存使用量。这不是什么大问题。但是一个60mb的文档会增加800 MB的内存,这对iOS设备来说显然是太多了。
I'm trying to change the app so that the peaks can be prevented or at least lowered. Alas, I don't exactly know which lines of code are responsible.
我正在尝试改变应用程序,以便可以避免或者至少降低峰值。唉,我不知道哪行代码是负责任的。
Is there a possibility to step through the code and also view current allocations or memory usage at the same time?
是否有可能遍历代码并同时查看当前分配或内存使用情况?
I know stepping through doesn't work when app is executed by Instruments. So, are there any other options?
我知道,当应用程序被工具执行时,跨过去是行不通的。那么,还有其他选择吗?
Here is how Instruments looks like:
仪器是这样的:
Thanks in advance!
提前谢谢!
2 个解决方案