In your code, do you require modules? They may hold on to some memory...
The other 'wild goose chase' is: do you 'write' to something that buffers but cannot empty the buffer?
I do not know if this is still true when writing to console in (IDE) disconnected case, a buffer will fill up and Espruino will eventually freeze... but you did not mention freeze, but memory loss.
Can you share some of the memory-destroying-suspicious code?
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.
In your code, do you require modules? They may hold on to some memory...
The other 'wild goose chase' is: do you 'write' to something that buffers but cannot empty the buffer?
I do not know if this is still true when writing to console in (IDE) disconnected case, a buffer will fill up and Espruino will eventually freeze... but you did not mention freeze, but memory loss.
Can you share some of the memory-destroying-suspicious code?