cancel
Showing results for 
Search instead for 
Did you mean: 

Page size allocation for malloc

MStuc.1
Associate II

In the STM32CubeIDE predecessor (Atollic IDE) it was possible to set the page size allocation for malloc.

MStuc1_0-1727425781692.png

Is this somehow also possible in the STM32CubeIDE?

Is my understanding correct, that this page size will be reserved from the RAM by the sbrk() function. Then the malloc gets the needed size from this buffer. As soon as there is no longer enough space, the sbrk() functions gets another block?

Kind regards

Mathias

5 REPLIES 5
Pavel A.
Evangelist III

In the C library that goes with CubeIDE you don't need it.

 

Thanks for the reply.

But can I change it from 4096 bytes (default) to e.g. 128 bytes?

Yes you can. But you don't need to, with the current version of newlib shipped with CubeIDE.

 

MStuc.1
Associate II

But if I would like to do it, how can I configure it?

By modification of _sbrk (sysmem.c in your project) or by modification of malloc in newlib and rebuilding the newlib.