Greetings,
Is there a reason for MQX not having a function to let me know how much free RAM memory it has?
I can't use MQX CodeWarior plugins since mine is a Basic version.
I'm using "_mem_get_highwater()", but if I understood correctly (I looked into the source code), it gives me the address of the highest allocated memory (which helps a bit), but as far as I know, this allocated memory could consume the whole RAM...
I noticed in the source a "_mem_get_size()", but it does not seem to be implemented.
Solved! Go to Solution.
There is one reason, why it is not implemented. Getting the size of free memory does not tell anything about if I can allocate some memory. Just for clarification, there can be 1 block of 1024 Bytes free or 128 blocks of 8 Bytes free spread over the whole heap, both situations return the same result of _mem_get_free.
There is another particular reason (which you can accept or nor) that when the call is not synchronized in multitask application by the user, he will not get right result (because immediatelly after evaluating a result, another task can allocate memory).
There is one reason, why it is not implemented. Getting the size of free memory does not tell anything about if I can allocate some memory. Just for clarification, there can be 1 block of 1024 Bytes free or 128 blocks of 8 Bytes free spread over the whole heap, both situations return the same result of _mem_get_free.
There is another particular reason (which you can accept or nor) that when the call is not synchronized in multitask application by the user, he will not get right result (because immediatelly after evaluating a result, another task can allocate memory).