I am using heap_4. My application allocate and free on run time. I have noticed today that code stuck at, line number 315.
code snippet starts
static void prvInsertBlockIntoFreeList( xBlockLink *pxBlockToInsert )
unsigned char *puc;
/* Iterate through the list until a block is found that has a higher address
than the block being inserted. */
for( pxIterator = &xStart; pxIterator->pxNextFreeBlock < pxBlockToInsert; pxIterator = pxIterator->pxNextFreeBlock )
/* Nothing to do here, just iterate to the right position. */
code snippet ends.
I have attached my debugger screen shot when this infinite loop encountered. You can see all the values in it. I have allocated heap size as 20480 bytes, on PIC24FJ256GB206. Free mem at that time was 9684 bytes. I log free memory when I free chunk to heap.
I think, these should be check, if next block is null. Please confirm.