A script enabled browser is required for this page to function properly.
Exit Print View

Oracle® Java Micro Edition Embedded Client Reference Guide, Version 1.0

Get PDF Book Print View

Document Information


Part I  Developer Guide

1.  Introduction

2.  Execution

3.  Developing Applications

Part II  Java Virtual Machine Reference

4.  Java Virtual Machine Capabilities

5.  Internal Memory Allocator

5.1 Red Zone

5.2 Statistics

5.3 GC Triggered When Native Memory is Low

6.  Threading

7.  Internationalization

8.  External PBP Porting Layer Plugin

Part III  Working Without An IDE

A.  Legacy Tools


Chapter 5

Internal Memory Allocator

Oracle JVM uses an Internal Memory Allocation and Statistics module for allocating memory from native heap. It provides this functionality:

5.1 Red Zone

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.

5.2 Statistics

The CVM's Memory Allocator module has been enhanced to record and report memory allocations at configurable granularity and size range(s).

This module provides statistics of the following kind for each configured range at the configured granularity:

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.

5.3 GC Triggered When Native Memory is Low

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.