In a microcontroller you have to see his API and it will not run Linux, much less Windows. But in microcontrollers it is like not using malloc()
, at least in real time scenarios or very high restriction, it can even have an API. Programming for microcontrollers is different from programming for microcomputers, so I say that people tend to want to make code that runs on Windows and the microcontroller and almost always that does not make sense. Even C's standard library often has a very different and limited implementation.
Memory at the micro level is somewhat complicated, and it is not easy to preach accurately, it depends on the application's allocation strategy, library used, architecture, and other factors. You can give
malloc()
and change nothing, because it will not actually allocate, it will use something already previously allocated in the operating system. There will be an internal allocation. This can occur because of a mapping issue or because
free()
does not always release to the operating system.
In Windows you already know the correct function, in Linux it is Sysconf()
.