Using too much memory in C/NDK?
I've recently found out there is no hard limit to how much memory you can allocate in C/NDK on Android. This is in contrast to Java where the limit is ~24Mb. I'm working on a few apps that could greatly benefit from using about ~50Mb total. Is this far too much memory to use? Does anyo开发者_JAVA技巧ne have any experience with developing apps that go above the Java limit and what impact this has across devices?
Obviously, I don't want to kill all background apps by consuming too much memory and I know the Android devs suggest not using too much memory but limiting all apps to ~24Mb is very limiting to certain kinds of apps. I've seen a few Android games recently that say they use ~256Mb.
I'm planning to use about 50Mb total for my app. Does this sound reasonable in terms of stability across devices that have a limit of 24Mb?
Sometimes it just can't be avoided, 24mb is a bit low but I think thats more of a thing thats just not been updated from the original devices which had much less ram. The 256mb thing, it doesn't surprise me that it's happened, but there's not been anything that big yet that it should be using so much, that's just laziness.
I wouldnt worry too much about going upto 50 so long as you try not to hold onto it all for too long if it can be avoided if it's something to run in the background. If it's foreground, it's probably not a problem.
精彩评论