Memory

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 128 MB in S60 devices and 2 MB in Series 40 devices. For detailed information about each device, see the Device Specification section on Forum Nokia

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.