Crash due to low free RAM available while uploading file

Hey,

Im following user crashes in our app for about a month.

Im using tools like firebase and fabric to get details on the crashes.

I was tracking one issue that appears pretty much and I was trying to look for an answer - unsuccessfully.

In our app, we use AWS s3 services to upload videos.

I found out that while performing this action of upload, some of the users experiencing crashes and from the tools I mentioned above I saw that most of them has a really low amounts of Available free RAM (2% - 4%).

I used instruments to check it and I saw that it does consume more resources (not something exceptional, but more than other actions in the app), however, there is not much I can do about it, because that's what the upload requires.

I was trying to think what is the best way to handle this case and I was looking for answers anywhere on the network. I read the documentation and discussions about this issue and saw that the recommendation is to free as much memory as possible when getting memory warning,

the problem is, that in this case, the upload produces some memory that I cant get rid of or free.

I also saw that the recommendation is not to change the flow of the app depends of the result of the amount of available free RAM.

So, I would really appreciate any advice on what to do in this case, because just letting the app crash is not something we want of course.

Thanks, Tal

Replies

You cannot control the ram available, but you may have information about it.


https://stackoverflow.com/questions/5012886/determining-the-available-amount-of-ram-on-an-ios-device


In such a case, I would:

- determine how much rAM you need

- test for RAM before downloading

- if less than needed, alert user that due to its low RAM, app may fail.

- if he/she takes the risk, he/she is informed.

- Or he/she can free some space.

In most cases free RAM is a meaningless concept. I had a post about this on the old DevForums, but that’s no longer available, so I created a new and improved version that you can find here. Please read it through to learn why you should ignore this particular statistic.

You wrote:

In our app, we use AWS s3 services to upload videos.

and:

I used Instruments to check it and I saw that it does consume more resources … however, there is not much I can do about it, because that's what the upload requires.

In general, uploading a video shouldn’t consume significant amounts of memory. Videos are sufficiently large that you should always upload them from a file, and such uploads have a constant, relatively low, memory usage (data is streamed from the file to the network, and thus you just need a few buffers).

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

I found out that its not the user's device issue but the s3 upload that consumes very large amount of memory,
But thanks for your reply!

Thanks alot,

If anyone is interested or finding it helpful,

I found out that its not the user's device issue but the s3 upload that consumes very large amount of memory (I used instruments to check what happens when Im trying to upload much bigger files than I tried before and saw that the usage of memory is much bigger than I thought).

After some more research I found that the way that aws is uploading the files, when using multipart upload is to cut the files to smaller chunks and upload them.

The operation of cutting the file to small chunks consume very much memory and thats what caused the crashes.

Waiting for aws reply.

Did you ever get a response and do you know how much RAM is needed?