Check Ram usage.

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Check Ram usage.

1,525 次查看
WOLF
Contributor I
Is there anyway to determin howmuch ram is being used by my program when running.  I call alot of functions over and over. and may be running out of ram at times.   Is there an easy way to see how much is allocated?
标签 (1)
0 项奖励
回复
1 回复

720 次查看
mjbcswitzerland
Specialist V
Hi

There are several scenarios, which depends also on the operating system used (if it is using stacks for each thread it will be necessary to also monitor RAM use of each thread. Possibly different stacks for user and supervisor modes too).

Assuming a more simple system there are three main types of memory:
- variables (fixed size which can be seen in the map file)
- heap (if used - possibly the malloc support includes some routines to monitor free space. Often fixed size set up in the linker).
- Stack (used by routines and interrupts).

The third can be monitored (to get an idea of the stack depth used) by filling all RAM with a pattern on start up. By then monitoring the amount of RAM which has not had its patttern destroyed it is possible to know the 'safety margin' between the lowest stack mark since the system started and the highest variable location.

The uTasker project supports these with function calls:
 - fnHeapAvailable();
 - fnHeapFree();
 - fnStackFree();

The results of these can be seen at the following on-line demo:
demo.uTasker.com  on the admin web page.

Regards

Mark

www.uTasker.com


0 项奖励
回复