Getting Free Memory

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 
1,011件の閲覧回数
rdazcal
Contributor III

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.

0 件の賞賛
1 解決策
519件の閲覧回数
JuroV
NXP Employee
NXP Employee

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).

元の投稿で解決策を見る

0 件の賞賛
1 返信
520件の閲覧回数
JuroV
NXP Employee
NXP Employee

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).

0 件の賞賛