1

Its an old post, but still in most of the places i found out that an android app gets around 16-32 MB memory

But when i check android Profiler, it says that my app is currently using around 350 MB memory on Samsung Galaxy S7.

I get OutOfMemoryException on my app a couple of times, I was curious why its happening. When i dig down a little i found out about 16-32 MB limit, but in actual my app is using 350 MB

I want to know how much memory a normal android phone gives to each app, or is it a variable number, and if no app is running android will not give outOfMemoryException, and if so many apps are in stack then there is a higher chance of OutOfMemoryException

But again there will be some limits.

enter image description here

dev90
  • 7,187
  • 15
  • 80
  • 153

1 Answers1

1

Android devices vary significantly now that the OS is getting older. You should definitely aim for under 32mb limit if you want your app to work on lower end devices to be safe. Unless you are loading some very large images it sounds like your code is leaking memory.

Start by removing any image (or other asset) loading from your app to see if you still have problems. If you do, check out LeakCanary, and when you find the leaks learn about them and why they are happening because it will help you immeasurably to become a better Android programmer. One of the chief ways apps leak memory is by passing an Activity context to a long running task :)

Daniel Wilson
  • 18,838
  • 12
  • 85
  • 135