How to measure memory in run time

yyang2000 wrote on Wednesday, 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. 


davedoors wrote on Thursday, 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.

yyang2000 wrote on Thursday, March 18, 2010:

Thanks Dave. If I need to learn how the heap fragmentation was, do you have ideal what function to be called?