Quality RTOS & Embedded Software

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


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 ]    [ Privacy ]    [ Sitemap ]    [ ]

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

Latest News

Version 10.1.0 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


FreeRTOS and other embedded software careers at AWS.

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

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

Xilinx Microblaze and Zynq partner