Skip to main content
Lars Beiderbecke
Senior III
April 25, 2019
Solved

Can I set the heap size to zero?

  • April 25, 2019
  • 3 replies
  • 1262 views

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?

This topic has been closed for replies.
Best answer by Tesla DeLorean

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

Some of ST's USB code uses malloc/free

3 replies

Piranha
Principal III
April 25, 2019

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!

Tesla DeLorean
Tesla DeLoreanBest answer
Guru
April 25, 2019

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 VenmoUp vote any posts that you find helpful, it shows what's working..
Pavel A.
Super User
April 26, 2019

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

-- pa