cancel
Showing results for 
Search instead for 
Did you mean: 

Can I set the heap size to zero?

Lars Beiderbecke
Senior III

In my STM32F72xx/3xx project, I'm not allocating memory dynamically, i.e., I'm using neither malloc nor free. And I'm restricting myself to C, with no C++ parts.

Is there a reason I shouldn't set the heap size to zero? Do any of the drivers, HAL or CMSIS, or FatFs, rely on the heap?

1 ACCEPTED SOLUTION

Accepted Solutions

FatFs, depends on the configuration, LFN support can use malloc/free.

Some of ST's USB code uses malloc/free

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

View solution in original post

3 REPLIES 3
Piranha
Chief II

Yes, You can and should do it. That is the only way how I make my projects and my projects do work. As far as I know (but can not guarantee) HAL doesn't use heap, though I do not use HAL anymore. Can't comment on FatFs.

What exactly do You mean by CMSIS? It has many different parts!

FatFs, depends on the configuration, LFN support can use malloc/free.

Some of ST's USB code uses malloc/free

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Pavel A.
Evangelist III

To be sure, fill the heap with some pattern before running your stuff, later check if it has (not) changed.

-- pa