Heap usage in MCUXpresso

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Heap usage in MCUXpresso

1,999 次查看
giusloq
Contributor III

I tried to understand how heap works in MCUXpresso. I read the User Guide and now I'm able to move the location and size of the heap, after changing to MCUXpresso Style for "Heap and Stack placement".

I also understood that the default heap overflow check takes care of the heap size configured in "Managed Linker Script". I tested this behaviour and it seems it works: after some malloc() call, it returns NULL. It seems the size configured in "Managed Linker Script" is taken into account.

Now I only want to understand better the mechanism of malloc() under the hood. I'm using "newlib (None)" as Library (I don't know if this is a good choice). What exactly happens when I call malloc()? I can't follow the source code in debug, because the function is in the library, imported as object file.

I downloaded newlib 2.4.0 source code (I have MCUXpresso 10.0.2_411) and I'm trying to follow malloc(), malloc_r().

0 项奖励
回复
3 回复数

1,377 次查看
lpcxpresso_supp
NXP Employee
NXP Employee

See : https://community.nxp.com/thread/469140 

Regards,

MCUXpresso IDE Support

0 项奖励
回复

1,377 次查看
Carlos_Mendoza
NXP Employee
NXP Employee

Hi Giussepe,

You can find more information about the libraries that come with MCUXpresso on the chapter 13. "C/C++ Library Support" in the MCUXpresso user guide, you can chose the one that fits better for your application based on their differences.

About the Newlib implementation of malloc, I'm not sure how it was implemented but newlib is open source and you can find more information on this link:

The Newlib Homepage 

Hope it helps!

Best Regards,
Carlos Mendoza
Technical Support Engineer

0 项奖励
回复

1,377 次查看
giusloq
Contributor III

Thank you carlosmendoza‌ for your answer.

Another question. How to monitor the heap usage during runtime? How to find the heap usage space, free space, and so on?

0 项奖励
回复