开发者

MonoTouch: NSData memory conservation

Does anyone know if it's more memory-efficient to use NSData.FromFile or FromStream开发者_C百科 vs filling an NSData.FromArray? My specific case is that I'm sending a large file via email (MFMailComposeViewController.AddAttachmentData). Right now I'm filling an NSData with the bytes that I want to send, but I was hoping that if I use NSData.FromFile or FromStream, it wouldn't ever keep ALL the file data in memory at once.


I think you are out of luck here. If you pass data on to AddAttachmentData(), the mail composer will most probably copy the bytes and hold them in memory (you should see from Instruments). Best you can do is to Dispose() your NSData as soon as you passed it on to release memory as fast as possible.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜