-
• #2
Sat 2021.05.22
'I wanted to know exact numbers'
Hi @d3nd3-o0 I went through that exact line of thought a couple of years ago. It isn't as clear cut as one would expect, as while querying using the WebIDE, those commands will make up the history part, and it will also depend on what type of data is being store and in what manner.
To satisfy my requirement, I needed to reserve around ~150 JsVars to avoid out of memory errors, and be vigilant about how and when I was accessing using the console and when I ran garbage collection.
tips, tricks, commands, code snippets:
post Jan 2019 Flat String creation failing where it worked reliably before
https://www.espruino.com/Reference#proceĀss
https://www.espruino.com/Internals -
• #3
Hi,
Is it accurate for me to do : 2100 * 16 == 33,600 bytes.
In the Bangle's case, yes. Some boards can get away with slightly smaller variables
Max memory usage for Javascript space is 33600?
yes
Its true bangle.js has 64 * 1000 bytes or 64 * 1024 bytes ram?
Yep. 64 * 1024
Does it make sense to take 64,000 - 33,600 = 30,400. And claim 30400 bytes are set aside for the firmware(espruino) to use, outside of Javascript?
That's right. There's the firmware, but also the execution stack, and the Bluetooth code reserves a bit too.
If I'm honest I'd have thought that we could get away with reserving a bit more for JS than just 33.6k though
>process.memory(); ={ free: 1175, usage: 925, total: 2100, history: 7, gc: 483, gctime: 6.43920898437, blocksize: 16, stackEndAddress: 536922232, flash_start: 0, flash_binary_end: 456948, flash_code_start: 1610612736, flash_length: 524288 }
Is it accurate for me to do : 2100 * 16 == 33,600 bytes.
Max memory usage for Javascript space is 33600?
Its true bangle.js has 64 * 1000 bytes or 64 * 1024 bytes ram?
Does it make sense to take 64,000 - 33,600 = 30,400. And claim 30400 bytes are set aside for the firmware(espruino) to use, outside of Javascript?
I wanted to know exact numbers so that I can calculate memory usage with math based on the data I wish to use.