You can probably see by typing trace() after a timeout is set. The timeout itself might take maybe 6 memory units, but the real killer is the function that you define to run in the timeout.
That needs the function code itself (which is copied each time because it was defined inside the function), as well as the scope in which the function was originally defined.
But either way I imagine you had lots of timeouts queued up. It's the kind of thing that would be really bad news even on a PC with loads of memory - it just becomes more of a problem more quickly on a constrained device.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
You can probably see by typing
trace()
after a timeout is set. The timeout itself might take maybe 6 memory units, but the real killer is the function that you define to run in the timeout.That needs the function code itself (which is copied each time because it was defined inside the function), as well as the scope in which the function was originally defined.
But either way I imagine you had lots of timeouts queued up. It's the kind of thing that would be really bad news even on a PC with loads of memory - it just becomes more of a problem more quickly on a constrained device.