On a microcontroller you have to see its API and it won’t run Linux, much less Windows. But on microcontrollers it’s like not using malloc()
, at least in real-time or extremely constrained scenarios, you may not even have an API. Programming for microcontrollers is different from programming for microcomputers, which is why I say that people tend to want to make code that runs on Windows and the microcontroller and almost always that doesn’t make sense. Even the standard C library usually has a very different and limited implementation.
Memory at the micro level is something complicated, and it is not easy to preach accurately, it depends on the application allocation strategy, the library used, architecture, and other factors. Can give a malloc()
and change nothing, because effectively there will be no allocation, it will use something previously allocated in the operating system. An internal allocation will occur. This may occur because of a mapping issue or because the free()
does not always release to the operating system.
In Windows already know the correct function, in Linux is the Sysconf()
.
Who vote negative could comment to know what improve in the question, I think is a very pertinent question and that does not exist in Stackoverflowpt !
– Fábio Morais
there is no standardized way to get this information, so I’ve been seeing in the OS in English what there are are approximate hacks...probably in a microcontroller also there must be some specific way to get this information... did not give negative
– zentrunix
I’ve been looking around too, didn’t want a standardized way, just something that worked.
– Fábio Morais