Quality RTOS & Embedded Software

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


How to measure memory in run time

Posted by Bill Yang on March 17, 2010

Re: FreeRTOS v5.03 + uIP + Web Server

I have a question regarding the heap2 memory measurement in run time. I am suspecting my project has memory issue. The project has implemented a web server with uIP TCP stack that sometimes ran quickly to respond the request from web browse, but sometimes it stuck took longer to responding or timeout. Then I have to recycle the system power to restart.

I know the xPortGetFreeHeapSize() function call can measure memory size, but I wonder when and where it should be called in run time to measure the heap over size or not. Does it need to create a task for measuring? Any suggestion will be welcome.

By the way, I used heap2 with MAX size 24000 in definition.


RE: How to measure memory in run time

Posted by Dave on March 18, 2010
You can call it from anywhere that is not inside an interrupt. It will show you the total free heap available but doesn't give you information on how the heap is fragmented.

RE: How to measure memory in run time

Posted by Bill Yang on March 18, 2010
Thanks Dave. If I need to learn how the heap fragmentation was, do you have ideal what function to be called?


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

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

Latest News

FreeRTOS v10.2.1 is available for immediate download. MIT licensed, includes 64-bit RISC-V, NXP Cortex-M33 demo, Nuvoton Cortex-M23 demo & STM32H745 dual core (AMP) demo.

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

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

Cadence Tensilica Cortes

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