Minimizing RAM usage
Jim Edwards
Posts: 54
in Propeller 1
Hi,
I am running into the limits of propeller RAM for my code and data and am looking at how to reduce it. I have a LCD display library which is rather large and I only use a small fraction of the methods available in it. Does the SPIN interpreter load the entire library into RAM or only the methods that are used? If the former, I could simply delete the unused methods and reduce my RAM usage. Thanks.
I am running into the limits of propeller RAM for my code and data and am looking at how to reduce it. I have a LCD display library which is rather large and I only use a small fraction of the methods available in it. Does the SPIN interpreter load the entire library into RAM or only the methods that are used? If the former, I could simply delete the unused methods and reduce my RAM usage. Thanks.
Comments
As far as I understand the original Propeller Tool will include everything into the binary for download, even unused methods.
Tools made by others do not. I think BST is one of them. Perhaps PropellerIDE. You might like to try those tools.
You could indeed manually delete any methods from any objects that you know you are not using in your program. It's messy but would work.
One of the downsides of simply bolting objects together is there are often parts of each object that are not used by your code. Traditionally thse are included in your resulting binary regardless. The unused code optimiser in bst looks at the code paths and leaves out methods that are never called, often resulting in significant size savings in generic objects.
BST is great for trimming away the fat. It's great for being a cross platform solution.
Sadly it's not maintained anymore but as far as I can tell it still works perfectly well.
I believe PropellerIDE uses PropSpin (think that's its name - written by Roy from Chip's PropTool Code). It removes unused methods, as Jon said. As this is newer, and the compiler is supported, then provided you can use PropellerIDE (platform???) this would likely be the better way to go. Otherwise, just use bst.
When you next get to running out of hub space, there are a few other things we can help you with, such as reclaiming the hub space occupied by any pasm code that has been loaded into cog(s) and not required any more.
FWIW heater was meaning that the spin interpreter itself is loaded into the cog, and there is no easy way to remove bits from it. It is loaded from ROM.
Just noticed your tag line -- please don't call me "Jonny"
Sorry, I have often called you Jonny from your handle. Shame its not possible to change your handle.
-Phil
As for your syntax problem, why not post the offending piece of code. If your code snippet is small put it between (code) ... (/code) tags to preserve the indentation. Note replace the () with the square brackets.