This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC1352R: malloc() hangs the system when running out of heap

Part Number: CC1352R

Hi,

I was testing to what would happen if I run out of heap. The below code will quickly hang the system. (In my case after "Hello 3").

  printf("Hello 1\n");
  malloc(0x4000);
  printf("Hello 2\n");
  malloc(6500);
  printf("Hello 3\n");
  malloc(0x8000);
  printf("Hello 4\n");

This is not desirable. If there is no heap available, I would assume that it will simply fail and return NULL. However, it is hanging the system.

I have looked at the source code and it is using xdc_runtime_Memory_Alloc(), with an Error_Block. So according to the documentation, the error should be handled, and not lead to a program termination.
I am using CC13x2 SDK 3.20.0.68.

Any insight? I would very much prefer it if the system would just return NULL (no memory allocated) and not hang.