11 years, 2 months ago.

Heap management in LPC1768 - allocation problems

Hi, I'm working with LPC1768. I've encountered strange behavior in heap management mechanism that I can't understand and I hope you'll help me to clarify this. I've have simple code that tries to allocate 24K bytes in the beginning of the program. The allocation fails. Then, I perform allocation of 1K in a loop until no more allocations can be done. This tells me approximately the size of the heap which is 26624 bytes. Then, I free the allocated memory and try to allocate 24K bytes again,. And this time the allocation succeeds. I wonder if this is the behavior expected.

In real code that will run on LPC1768, I have large allocation in the beginning of the program. Is there any way to configure heap management and avoid this behavior?

Sample code that I'm running - /media/uploads/jeniak/mbed_simple_demo1.cpp

Output I get - /media/uploads/jeniak/output.png

Appreciate your help

Be the first to answer this question.