Replace ANSI C (glibc, uclibc), malloc(), calloc(), realloc(), free() with the Real Time OS functionality, allowing the JVM to use these APIs on platforms which lack memory allocation features.
Gather and provide memory usage statistics (amount of memory used, time spent in allocation, etcetera) which are used to fine tune the memory behavior of the application. For example, if you know which buffer sizes are used the most you can define an exact allocation size, achieving minimal internal fragmentation without losing allocation speed.
Enable full control over the memory allocated by the VM, including deallocating all memory at VM shutdown, monitoring memory allocations per Xlet, and enabling separate pools for separate needs. For example, separate pools can be created to support different types of hardware memory, or to limit a specific pool to specific size.
The memory allocator 'RedZone' feature, marks 32 bits right before an allocated area and 32 bits after, and checks these bytes for validity after they are freed. In the debug version a warning is printed if stamps are not valid, as the cause is most likely an out of bounds array write or something similar. This feature also improves the stability of the internal allocator, as it serves to indicate that the internal control structure which resides in the area may be damaged and should be discarded. The ‘RedZone’ is enabled by default after verification that the performance impact of the 32-bit comparisons is negligible.
This module provides statistics of the following kind for each configured range at the configured granularity:
Total number of allocation
Total number of free
Maximum outstanding buffers seen
Time spent in allocation
Time spent in free
At the Java application exit, the collected statistics would be printed on console.
Note - To avoid performance overhead at runtime, statistics collection is not enabled in the optimized binary. Statistics collection can be enable on request.
The VM memory allocator can trigger garbage collection (GC) when system malloc returns NULL. This is useful on devices where the amount of RAM is small and GC must occur to release native resources. In this case, GC is automatically triggered by the VM.