An archive of as of Saturday January 26, 2019.

Reducing memory consumption


Hi, I have what I think is a little program but it seems to be taking up a lot of Esquilo memory.

It's going from about 66% to 75%. I'm guessing when something is running it goes up and down when it's not running. Not sure what they would be unless it's happening when I check temp on the sensors.

Do you have any tips on making my program use less memory? I want to add more features to it at some point.

Is there a way to increase memory on the Esquilo? I mean memory that it uses to run programs, not storage.

Is having classes take up more memory than if I just had the functions and variables alone?

How much does the IDE take up and will that be gone when the IDE is not being used?

I've turned off most everything in services and load them in the program using require.




A small Squirrel program should not take up that much memory for its code even if you are using a few sensors. Are you using large data structures or memory blobs? Can you share any of your code?

The 256K SRAM in Esquilo is used for both Squirrel code and data. The way Esquilo works is that when you run a program, it compiles the text into byte code and stores it in SRAM. The Squirrel VM runs this byte code to execute your program. Any dynamic memory for data structures is also allocated from the SRAM. The 1MB flash stores the bootloader, EOS code, the boot nut, and the IDE. The flash is not directly used by your Squirrel program except for the boot nut.

Not really. The extra overhead for a class is pretty trivial.

The IDE will use a little bit of dynamic memory for the network connection buffers and executing its RPC requests. I would guess that you would save 5KB or so when the IDE is not running.

That's the best way to save memory. You can also save a lot of memory by turning off network services you are not using. If you are using the Esquilo Nest (Network Secure Tunnel in the IDE), it needs about 30KB free to negotiate the TLS connection but will free all of this as soon as it is connected. You can delay starting your program a few seconds after boot if you are close to running out and are using the Nest.


There are to many files to put in the reply box so I zipped them up and here is a link to them.

Don't laugh to hard at my code, It may not be the most efficient lol.

When the Esquilo is turned on it's at 25% memory. After I load my program which is TempSensor.nut it's at 69%