Can I change Java heap size on Android devices?



  • I have a Samsung Galaxy A20s with Android 11 and 2790 MB RAM. The phone was originally designed for Android 9.0 but now that it's been upgraded to 11; it's become slow and my RAM is always almost full and the https://play.google.com/store/apps/details?id=com.inkwired.droidinfo app says my Java Heap is 192 MB.

    is there any way I could change the heap size? It's way too high for my A20s.



  • It seems like you use some sort of system info app that shows you a value and you assign a meaning to the value it never has:

    Java Heap and it's size

    The Java heap is (a bit simplified) the main memory pool of a Java application. Therefore if your used app shows you that the Java Heap is 192 MB then this means that the Java part of this Android app currently uses 192MB RAM (assuming the app developer has calculated the used RAM in a correct way, calculating the current heap size on Java is https://stackoverflow.com/a/55198260/150978 not sure if it is also that complicated on Android).

    This also means the Java heap size of every Android app is different. This is not a general limit but just the RAM usage of each Android app.

    Your question was how to change that value - as you can see this question doesn't make sense as this is not a configured value somewhere in the system but just the RAM usage of an app.

    If you have RAM problems make sure you don't have apps running you don't use (disable or uninstall unused apps). Also for some common XXL apps like https://play.google.com/store/apps/details?id=com.facebook.katana there are https://play.google.com/store/apps/details?id=com.facebook.lite available which are designed to consume less resources like RAM. Switch to those lite versions where applicable would be another recommendation to save RAM.


Log in to reply
 


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2