Question about Out of memory #2090
Replies: 2 comments
-
Posted at 2017-03-23 by @gfwilliams Hi - yes, it's an issue with JavaScript's handling of arrays. Since arrays can hold absolutely anything, by default they're not very memory efficient. However if you tell Espruino what you want to put in them then you can do much better. Try:
and you should be fine (it'll be around 8 times more efficient!). You can compact them down even more (for instance storing them in an array of bytes), but then you have to worry about scaling. There's a bit more information about memory efficiency here: http://www.espruino.com/Performance |
Beta Was this translation helpful? Give feedback.
-
Posted at 2017-03-23 by SergeP Thank you! It works! Overall memory usage is 6 times less! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2017-03-23 by SergeP
Hi!
I have tried to use Puck.IR to control my LED Light strip.
After a few days of mining I have collected commands from remote control.
But when I have tried to write them to Puck, I have Out of memory.
After I have removed few commands it starts working. But nearly full memory is used.
Is it correct? How can I reduce memory usage?
Working version looks like this:
and after I send it to Puck.js process.memory() output is:
Beta Was this translation helpful? Give feedback.
All reactions