Any method to estimate memory usage for a program?
![WBA Consulting](https://forums.parallax.com/uploads/userpics/358/nE82I1MYQ1NPJ.png)
When I first tried merging the SHT11 demo code with the VMusic2 Datalogger code, I ran into a lot of "out of memory" errors. I eventually trimmed up my program by pulling out all of the humidity sections and even recycled some variables to share between the VMusic2 and SHT11 subroutines. I finished it off very lean and yet the memory map is rather full. code is in this thread: http://forums.parallax.com/showthread.php?p=792332
In the meantime, I've taken a look at some other programs posted recently on the forums and some seem to have many more variables in use than me so I was wondering about the errors I originally saw.
If I am planning to piece together a couple programs, how can I guesstimate whether or not I will have sufficient memory space?
thanks
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Andrew Williams
WBA Consulting
IT / Web / PCB / Audio
In the meantime, I've taken a look at some other programs posted recently on the forums and some seem to have many more variables in use than me so I was wondering about the errors I originally saw.
If I am planning to piece together a couple programs, how can I guesstimate whether or not I will have sufficient memory space?
thanks
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Andrew Williams
WBA Consulting
IT / Web / PCB / Audio
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Mike2545
This message sent to you on 100% recycled electrons.
mainCounter VAR word
servoCounter VAR word
you can just use
counter VAR word
Another thing to do is to figure out the scope of each variable that you would like to use. I use scope in the C++/Java sense of the life of a variable. Anyway, figure out which variables are in which scope (a venn diagram type might help here) and discover which variables are in scopes that don't overlap. Those two variables can then share the same memory space, either by using the same name or aliasing.
Edit: Here's a thread I had a while ago, and it may help you get some of those buffer bytes back.
http://forums.parallax.com/showthread.php?p=741388
Post Edited (SRLM) : 4/7/2009 1:41:36 AM GMT