Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT




Loading

infinate loop on malloc

Posted by Phil on September 13, 2005
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?

RE: infinate loop on malloc

Posted by Richard on September 13, 2005
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.


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]




Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

FreeRTOS kernel V10 is available for immediate download. Now MIT licensed.


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS