How to handle the low memory warning

In my application, I am getting a low memory warning after several downloads. I stops the current download process. Even after that, apps crash as well, and my guess is that apps crash due to low memory. Can someone please let me know how can I free memory in application startup.

0


source to share


1 answer


It looks like you are loading files directly into memory. This will be a problem because you don't have enough memory to load the entire file.

The strategy you should take is that when the file is loaded, it continues to write chunks of it to disk, freeing up memory in the process.



If you are using NSURLSession, there is a parameter that you can use to do this with minimal effort. Please post your code for in-depth reference.

0


source







All Articles