• Yes, memory usage is high, this is actually with code uploaded to ram so it can be better. Still before trying to create the font, ther are like ~500 variables free so was hoping this could work. This is more like stress test of Espruino memory, not that I couldn't do it better. There are quite a lot of flat strings, more than I expected, any way to find them? Can it be the javascript code that is uploaded?

    I guess the main thing from this is that it would be nice to get non-flat string from the array buffer somehow so it is not need to call E.toString on large arrays.

    IIRC the defrag won't move flat strings - I was concerned about what you'd mentioned earlier - moving stuff that you had a pointer to.

    Maybe it could be some flag to E.defrag() to force it when called explicitly. I can handle that in my own code if I can call it myself with that flag when needed, now sure how much espruino internal usage of flat strings would break (if there is any).


Avatar for fanoush @fanoush started