Configurable size LUT using array in C - embedded systems
The problem is not in using malloc() itself, the problem is with allocating and freeing memory chunks of arbitrary size repeatedly. If you only perform the allocation once and never free the block without restarting the device then you won't run into this problem.