Debugging memory usage #6614
Replies: 1 comment
-
Posted at 2022-02-02 by jeffmer That's really neat. I tried it on my Bangle and also an emulated Bangle (ROCK). On the Bangle, ROOT is the centre of the network while the ROCK has two centres Hidden Root and Timers - a much larger network since everything is written in Espruino. BTW - what network display code are you using? - the animation and layout is very impressive. Posted at 2022-02-02 by @allObjects ...ready for the art gallery (sorry @gfwilliams: had to sign it w/ espruino 22 ) Attachments: Posted at 2022-02-03 by @MaBecker wow, this is very helpfull! Attachments: Posted at 2022-02-03 by Raik I am not able to fully comprehend this graph, but I am seeing this dandelion like structure from my Bangle 2. Is this normal? Attachments: Posted at 2022-02-03 by @gfwilliams Great - glad it's helpful! The graph vis is https://github.com/visjs/vis-network - I tried this a while ago (you can see E.debugVariables got added a long while back) but never found something that would visualise it properly before. The complaints about Recorder using a bunch of RAM got me to try it again, and as it happens I spotted some ways the interpreter could save some memory, so firmwares from the last day should be a bit more frugal. @raik that's cool. What you're seeing there is a bunch of JS arrays (one var per index element). You can see they're all referenced from one point (another array?) which it itself referenced from ROOT (you can see the red line). Not sure what clock face you have, but it's possible that it could be using a Typed Array instead, which wouldn't need all the index vars so could save a decent amount of memory. I guess these sorts of things would be good in the README to give an idea about what to look for Posted at 2022-02-03 by Raik
I'm using the Numerals. Ah, those plumes originated from the numerals polygon definition then.
I'll see how I could be rewriting this. Posted at 2022-02-03 by @gfwilliams That looks like the issue then :) Ideally you'd put it all in one big Uint8Array, but while not optimal, what is there may not be the end of the world |
Beta Was this translation helpful? Give feedback.
-
Posted at 2022-02-02 by @gfwilliams
I just added a tool at https://espruino.github.io/EspruinoMemView/
This tool allows you to connect to an Espruino/Bangle.js device via Web Bluetooth and then display the contents of RAM as a Network.
It’s a good way to look into your code and see if there’s anything obviously using memory that shouldn’t be.
It's a bit of a hack right now but it is very useful, if only to look at what's going on inside Espruino - so any PRs to make it work better would be hugely appreciated!
Beta Was this translation helpful? Give feedback.
All reactions