Check Ram usage.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Check Ram usage.

1,072 Views
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?
Labels (1)
0 Kudos
1 Reply

267 Views
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 Kudos