Many posts have talked about Android heap size, and so far what I've found out is that the only common thing about max heap size is that it's at least 16MB, but that was the limit ever since API 3. For using more memory, people would suggest to use the NDK or anything that is beyond the "normal" Android development.
Is there any Android version that has a requirement from the devices to have a larger heap size, so that I could start assuming a larger one and stop being so cheap on memory?
Is there also a requirement about the flag of the large heap (from API 11 - honeycomb) inside the manifest, or is it a vague request that the device might even ignore it?
It's just that the Android hardware has improved so much over the years, yet we still need to be so cheap on memory even though devices now have more than 1GB of ram. And it's weird that we can't ask from the OS to get us a specific amount of heap size and promise it that we won't use any more of this.
By default, Android Studio has a maximum heap size of 1280MB. If you are working on a large project, or your system has a lot of RAM, you can improve performance by increasing the maximum heap size for Android Studio processes, such as the core IDE, Gradle daemon, and Kotlin daemon.
The default startup heap size is 1.5 GB. This value must be a number between 1.5 GB and the maximum amount of memory allowed by your operating system and JVM version. Consider the following examples: If you have a Windows system with a 32-bit JVM, then a process can have a maximum heap size of 2 GB.
The heap size is the amount of memory allocated to objects that are being defined in your Apex code. And Apex code puts in a limit to the total allowed size of the apex heap size. This governor limit is calculated at runtime and depends on how the governor is invoked.
Initial heap size is 1/64th of the computer's physical memory or reasonable minimum based on platform (whichever is larger) by default. The initial heap size can be overridden using -Xms. Maximum heap size is 1/4th of the computer's physical memory or 1 GB (whichever is smaller) by default.
ok, i've finally found the answer (thanks to this post) :
the bare minimal for all versions of android (including 5) , is 16MB.
the requirements for each of the android versions can be read about here:
http://source.android.com/compatibility/downloads.html
you can read about them by opening the CDD files and searching for "Runtime Compatibility" (or "Virtual Machine Compatibility" for old versions). also, you can find the minimal RAM requirement by searching for "Memory and Storage", but i think it's only the requirement for the system itself.
so, for example, on 4.0.3 - 5 the minimal heap size is:
I can't find the minimal heap size for versions 3.x but it's probably the same as 4.0.3 .
for 2.1 - 2.3 , the minimal heap size is :
Device implementations with screens classified as medium- or low-density MUST configure Dalvik to allocate at least 16MB of memory to each application. Device implementations with screens classified as high-density or extra-high-density MUST configure Dalvik to allocate at least 24MB of memory to each application. Note that device implementations MAY allocate more memory than these figures.
meaning:
i can't find the minimal heap size for version 1.6 , but it's probably the same as 2.1 .
also, i can't find out what should the large-heap flag do for each of the android versions (since 3.0) .
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With