infinate loop on malloc

I have an app which deletes and creates tasks. It appears that I have an infinate loop on the following code in PortMalloc:             while( ( pxBlock->xBlockSize < xWantedSize ) && ( pxBlock->pxNextFreeBlock ) )             {                 pxPreviousBlock = pxBlock;                 pxBlock = pxBlock->pxNextFreeBlock;             } This is where it is looking for, I guess a ‘first fit’ block.  Any ideas?  Has something gotten corrupted?

infinate loop on malloc

I think you are right, something in the data structures must have got corrupted.  Should not ever get stuck there. Presumably from the sample heap_2.c.  Note that this does not join adjacent blocks together so it can get fragmented.  If the only things being allocated at run time are tasks, and each task has the same size stack, then this should not be a problem as the block size being allocated each time will be the same.