SimpleIDE C beginners question. What's eating all my hub ram?
Alex.Stanfield
Posts: 198
Hi, how do I get a memory usage listing when compiling with SimpleIDE C. I'm using CMM and with a very simple program all available memory gets consumed very easily.
Thanks
Alex
Thanks
Alex
Comments
Just right click on the main .c file and select "Show map file" (compiles and gives the addresses and sizes of code and data)
Alex
I'm not aware of such a tool.
Here's some common causes:
* printf - use printi from the Simple package when possible (or print if you need floating point support)
* any use of floating point variables
* many of the functions in the math library (libm.a/math.h)
* Using C++ and accidentally including something from the standard library (exceptions, for instance)
* malloc & free take a lot of space
* SD card usage is quite heavy (i.e.: sd_mount)
If you post your code, I (and many others) would be happy to take a look
I'm not aware of a lot of things
I'm sorry I haven't explained myself quite well. I just needed the map file to see how much memory I was using up and with what part of the code.
BTW: I noticed that just including a file in the project manager gets the whole code linked even if there is no calling to any code in that file. Is there a way to avoid this other than excluding the file? Doesn't the linker sort out the code needed ?
Alex
If you use that, pruning will be enabled which will remove unused functions.
With regard omitting unused code from the final binary see this thread:
http://forums.parallax.com/showthread.php/147068-solved-Garbage-Collection-again?p=1173498#post1173498
Especially post #14
http://forums.parallax.com/showthread.php/147068-solved-Garbage-Collection-again?p=1176999&viewfull=1#post1176999
Correct! Thanks a lot!
It's a checkbox in the "compiler" tab of the project manager.
Alex
Thanks Heater, I have to re-read the SimpleIDE manual as this option wasn't there before (and I incorrectly assumed it was a natural part of the linking stage)
Now I feel some relief, since my project was just starting and already memory exhausted.
Is there a "tips" page for people familiar with the prop (SPIN/PASM) in transitioning to C (already knowing C/C++)?
I mean, space saving, memory model choosing vs board type, multiple code instances, cog usage, etc, etc.
Alex
If such a thing does not exist yet, or has not been compiled into a single, useful document/page, I'll create it in PropWare's documentation. This is definitely something the community needs.
Alex
That's a great page Cody, thanks a lot.
Alex