My app has a thread that does some time consuming job for more than a minute and the app consumes around 6.8MB of memory. I receive a memory warning after sometime and then it gets killed. There is nothing that I can release, and I am using not even 7MB of memory...driving me crazy...any advice please?
Maybe your memory is super-fragmented? Even 7mb full of leaked data shouldn't kill your app. You ought to have at least 20mb to play with. Try rebooting the phone and see if that helps.
I still do not know why it is happening, but now I have a found a workaround. Instead of running this job in a thread, if I run it on the main thread, neither I receive memory warning not it gets killed. But then I cannot show the progress in the UI. I am going to use NSTimer to do it.
来源:https://stackoverflow.com/questions/2875990/my-iphone-app-gets-memory-warning-and-killed-at-6-8mb