Could not allocate required memory

Hi,

After adding ANCS client service to my firmware, firmware crashed.

Investing I could see it was failing to allocate memory

File: task.c

Line no: 2012

else
{
/* This line will only be reached if the kernel could not be started,
because there was not enough FreeRTOS heap to create the idle task
or the timer task. */
configASSERT( xReturn != errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY );

I tried to optimize the code, but still the error didn't get resolved.

I tried to increase the heap size, earlier it was ( 2*4096). 

#define configTOTAL_HEAP_SIZE                                                     ( 3*4096 )

After this change firmware didn't crash after flashing.

Please let me know if this is the correct fix. 

Thanks,

Related