Help with iOS app crashing with "Out Of Memory"

I have an application for iPhone / iPad made in MonoTouch, which is already in the Apple store. However, there is still a problem that has not been completely resolved. I need to be able to upload large files to our servers. Sizes can vary from 2 to 100 MB. I tried several approaches:

  • Using SOAP Web Services, sending an array of bytes: a) Sending the entire file. Crashed. b) Splitting in pieces of 1 MB. Failure after 10-15 pieces (varies).

  • Using WebClient.UploadFile. It works most of the time with smaller files <5 MB, but from time to time it crashes and more than 10-12 MB. On the server, I have an aspx page that receives information sent via POST

Here is the actual device code:

WebClient wc = new WebClient ();
string sLFN = sLocalFileName;
FileInfo fi = new FileInfo (sLFN)
string sUri = getUri ();
byte [] f = wc.UploadFile (sUri, sLFN)

I believe that the memory capacity of the iPhone / iPad directly affects this.

Does anyone have any recommendations or suggested approach that I should follow?

Thanks in advance

Edgar Herrador

+3
source share
2 answers

I would recommend using Streaming and Chunking. You will probably exceed the message size when transferring large files.

Do you get any exceptions?

+1
source

Have you tried WCF streams (http://msdn.microsoft.com/en-us/library/ms733742.aspx)?

0
source

Source: https://habr.com/ru/post/1794339/


All Articles