CONFIG_SYS_HEAP_ALLOC_LOOPS

Number of tries in the inner heap allocation loop

Type: int

Help

The sys_heap allocator bounds the number of tries from the smallest chunk level (the one that might not fit the requested allocation) to maintain constant time performance. Setting this to a high level will cause the heap to return more successful allocations in situations of high fragmentation, at the cost of potentially significant (linear time) searching of the free list. The default is three, which results in an allocator with good statistical properties (“most” allocations that fit will succeed) but keeps the maximum runtime at a tight bound so that the heap is useful in locked or ISR contexts.

Default

  • 3

Kconfig definition

At <Zephyr>/lib/os/Kconfig:33

Included via <Zephyr>/Kconfig:8<Zephyr>/Kconfig.zephyr:33<Zephyr>/lib/Kconfig:16

Menu path: (Top) → Additional libraries → OS Support Library

config SYS_HEAP_ALLOC_LOOPS
    int "Number of tries in the inner heap allocation loop"
    default 3
    help
      The sys_heap allocator bounds the number of tries from the
      smallest chunk level (the one that might not fit the
      requested allocation) to maintain constant time performance.
      Setting this to a high level will cause the heap to return
      more successful allocations in situations of high
      fragmentation, at the cost of potentially significant
      (linear time) searching of the free list.  The default is
      three, which results in an allocator with good statistical
      properties ("most" allocations that fit will succeed) but
      keeps the maximum runtime at a tight bound so that the heap
      is useful in locked or ISR contexts.

(The ‘depends on’ condition includes propagated dependencies from ifs and menus.)