vApplicationMallocFailedHook() understanding

roujesky1 wrote on Friday, October 11, 2019:

Trying to understand vApplicationMallocFailedHook(). Looking at the comments. It will be called if pvPortMalloc() fails. configTOTAL_HEAP_SIZE is defined at 28000 which, I think is the default, since I never changed it. I have a situation where I defined a bunch of variables and finally ended up in vApplicationMallocFailedHook.
Information:
Microchip PIC32MX795F512L. MPLabX4.10
configUSE_MALLOC_FAILED_HOOK = 1
My Dashboard says that I am using 31% of Data Memory which is 131072 bytes. So can I just increase configTOTAL_HEAP_SIZE from 28000 to 30000 and that should help alleviate my problem?

thanks!

aggarg-aws wrote on Friday, October 11, 2019:

Yes, you can increase the configTOTAL_HEAP_SIZE to increase the heap. You can also examine the call stack when you end up in vApplicationMallocFailedHook() to be sure that it is a genuine memory allocation.

Thanks.

roujesky1 wrote on Friday, October 11, 2019:

Thanks Gaurav Aggarwal
much appreciated!