Quality RTOS & Embedded Software

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


heap_4 - infinite loop in prvInsertBlockIntoFreeList() from vPortFree() or pvPortMalloc()

Posted by gabor90 on July 8, 2015


I have some problems using this code: In the prvInsertBlockIntoFreeList() 's

for( pxIterator = &xStart; pxIterator->pxNextFreeBlock < pxBlockToInsert; pxIterator = pxIterator->pxNextFreeBlock ) { /* Nothing to do here, just iterate to the right position. */ }

this turn into infinite loop,


pvPortMalloc() 's while( ( pxBlock->xBlockSize < xWantedSize ) && ( pxBlock->pxNextFreeBlock != NULL ) ) { pxPreviousBlock = pxBlock; pxBlock = pxBlock->pxNextFreeBlock; }

It has the same issue.

For example, in prvInsertBlockIntoFreeList(): pxIterator 's value ==> 0x200157d8 xBlockLink * pxIterator->pxNextFreeBlock ==> 0x200157d8 struct ABLOCKLINK *

I found some similar topic in this forum, but they cannot help me: - is declaration corrupt? Why and what data could be corrupt? - overwrited data? how can i find that?

The classes, which i use, call pvPortMalloc() and vPortFree() functions are working fine.

I tried to increase the totalHeap, but it didn't help me.

I use FreeRTOS V7.3.0 and heap_4.c.

Thank you for all help, Best regards Gábor

heap_4 - infinite loop in prvInsertBlockIntoFreeList() from vPortFree() or pvPortMalloc()

Posted by rtel on July 8, 2015

Things to check include:

1) That the same block is not being freed twice. Recent versions of FreeRTOS will trigger a configASSERT() if the same block is freed twice, but I'm not sure if V7.30 (which is a bit old now) has this assert check or not. Do you have configASSERT() defined?

2) Nothing is corrupting the memory immediately in front block being freed, which contains some meta data.


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

Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.

Free TCP/IP and file system demos for the RTOS

Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

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

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

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

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists