Resources | developer.brewmp.com Resources | developer.brewmp.com

Developer

resources

Configuring heap size

OEMS can configure the kernel heap size and the split heap sizes. The page heap size cannot be configured; the memory pool managed by the page heap contains memory that is not in use.

Kernel heap

The kernel heap size (SCL_CS_KHEAP_SIZE) is defined in builds file, which is in the AMSS in the /build/ms directory. OEMs can modify the value of SCL_CS_KHEAP_SIZE. OEMs can adjust the OS Services kernel heap size by changing the value of this macro and rebuilding the device software.

Split heap

Split heap is a new feature in Brew MP 1.0.4 that can be used to reduce fragmentation. When split heap is enabled, the kernel heap is divided into two partitions. One partition is used to allocate large blocks of memory and the other is used for small blocks. Split configuration and tuning is a time-consuming process and must be done carefully. Improper configuration values can degrade performance.

For devices that support split heap, Heap Analyzer will show statistics for both big and small heap. The Heap Analyzer Bucketizer shows heap statistics based on allocation sizes, which provides information on heap usage trends over a period of time. For more information, see the Heap Analyzer Help.

OEMs can configure the following values for split heap:

  • CS_HEAP_SMALL_SIZE: specifies the size of the small heap in bytes. The remainder of the heap is allocated to the large heap.
  • CS_KHEAP_SMALL_THRESHOLD: specifies the size in bytes for memory blocks that will be allocated from the small heap. Memory blocks less than or equal to this size are allocated from the small heap. Blocks larger than this size are allocated from the large heap.
  • CS_KHEAP_ALLOW_SPILLOVER: A TRUE/FALSE value indicating whether spillover is enabled. When enabled, allocation requests that fail can be allocated from the other heap (spillover is also referred to as soft split). Disabling spillover is referred to as hard split. When spillover occurs, the fragmentation benefits of split heap are lost, but an out-of-memory condition may be prevented.

Note: It is highly recommended that initial calculations for split heap configuration be done using DUMPHEAP logs, Heap Analyzer, and Heap Usage Tracker (HUT).

For more information on split heap configuration, see Split heap configuration example and Tuning split heap configuration.