wasted heap space

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

wasted heap space

178 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by charchar on Wed Mar 25 16:39:02 MST 2015
I'm playing with heap overflow checking mechanism by defining the function __check_heap_overflow.  This function gets called every time the heap grows past a 4K boundary.  I'm guessing because the heap advances 4K at a time.... Is there a way to tweak this value?  It results in up to 4K of memory being unallocatable (worst case) when the heap reaches its limit.

thanks
0 Kudos
1 Reply

160 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Thu Mar 26 01:02:23 MST 2015
I suspect that you are using Newlib? IIRC this will grab a 4KB chunk for the heap, then subdivides this in further calls to malloc, until more memory is required, when it will grab another 4KB chunk.

You could try using Newlib-Nano which I think handles the heap differently to the full Newlib library, or else Redlib, which definitely does.

http://www.lpcware.com/content/faq/lpcxpresso/switching-selected-c-library

Regards,
LPCXpresso Support
0 Kudos