-->
Page 2 of 2

Re: Out of memory but heap shows about 5kb available

PostPosted: Wed Feb 24, 2016 3:52 pm
by devsaurus
The node.heap() function shows the total amount of available memory on the heap. If the heap is fairly fragmented there might be a lot of small free pieces that sum up to a big number. It seems that you have enough headroom to further consume heap. But once the firmware tries to allocate a larger chunk and that doesn't fit into one of the free slots... out of memory.

Re: Out of memory but heap shows about 5kb available

PostPosted: Thu Feb 25, 2016 11:39 pm
by pit
Devsaurus, this sure is a good theory. It's just so that I'm running the test right after a reboot, so I wouldn't think much allocation/deallocation causing gaps has happened.

Re: Out of memory but heap shows about 5kb available

PostPosted: Sat Mar 05, 2016 3:10 pm
by TerryE
Look at the source for goodness sake. The table allocator uses a doubling algo, so to store the 513th entry it must allocate a new 1024* size_t vector ( and after the copy free the old 512 entry copy. Allocatin chunks that size can fail when you've only got ~8Kb left.