MMA MEMORY USAGE DEBUG


1. Overview

DDR total memory = linux memory(cat /proc/meminfoçš„MemTotal) + mma(mma_heap_name0 + MMU_MMA) + kernel reserved

Kernel reserved is generally fixed. When mma increases, the corresponding linux memory will decrease, otherwise the linux memory will increase.

Linux memory is generally allocated by the linux system, such as malloc. mma is used by the internal hardware IP of the SDK. Linux oom shows that linux memory is not enough, please increase linux memory by reducing the size of mma; mma alloc fail shows that mma is not enough, please increase the size of mma appropriately.

The allocation of mma and linux memory size should be determined according to the user's actual use scenario. The basic principle is to use the surplus mma for linux memory in the user's maximum use scenario to ensure that the system memory is sufficient.


2. mma alloc fail

  1. Increase the debug level of sys to MI_DBG_KMSG. When failed to allocate mma, it will automatically print the usage of mma:

  2. If chunk_mgr_avail is not enough, increase the value of sz in config:

  3. If chunk_mgr_avail is enough, but there is no continuous block of buf enough to allocate (memory fragmentation), you can turn on the MMU to optimize the memory fragmentation problem and increase the MMA usage rate. To open MMU, you only need to add MMU settings in config:

    The MMU size named sz,

    After opening the MMU, most of the memory of the SDK will be allocated in the MMU. The size of MMU_MMA can be set close to the size of mma_heap_name0, and then use cat/proc/mi_modules/mi_sys_mma/MMU_MMA to view the use of MMU Circumstances, then decide how much memory needs to be allocated.

  4. Under what circumstances need to adjust the mma/MMU memory allocation:

    Print [MI ERR] when the program is running: MI_SYS_IMPL_MmaAlloc[6195]: fail!

    VDEC failed to apply for mma memory, mma memory need to be increased.