The Java heap is reserved from host OS memory. The amount of free RAM varies between devices, it’s typically between 15 – 25 MB. Java heap is grown and shrank dynamically and it can grow up to 16 MB.
Not all Java objects are necessarily stored in the Java heap, some parts
can be stored also in host OS memory. For example, only a handle for Image
is
stored in the Java heap and the actual bitmap is stored in host OS memory.
This can cause a discrepancy between Runtime.freeMemory()
and
actual free RAM in device. It is possible that OutOfMemoryError
can
be thrown even when it would seem that object should fit to Java heap.
On some S60 3rd Edition devices, system property com.nokia.memoryramfree
can
be used fetch free RAM, see section System
properties for more details.