You are reading a single comment by @tve and its replies. Click here to read the full conversation.
  • write code into the upcoming native strings, which would be malloc'd

    I don't think this is a good idea given there's not that much RAM - I think it'd be too difficult for most people to use... If code could be used from flash it'd be amazingly useful though?

    I don't understand. There isn't that little RAM either. Currently there's 13KB available. It's just that if you request a web page that has 10KB in it, you might need ~6-7KB just for that (due to TCP window size and a few extra buffers). If I allocate 8KB of these 13KB to JSvars then that's a fixed commitment. Basically an espruino program with little code but lots of network activity will crash reliably. But if I automatically put module code into malloc'ed RAM then there's no fixed commitment. It just means that users that require large modules will need to be more limited on the communication side. What is difficult to use?

    Running code from flash may be an answer, but it does require quite a bit more work. Is there a place where code finds it "final resting place" in a flat string where I could add code to move it to a native string allocated in flash? I'd also need a hook to free it again, I suppose. Or perhaps I could change the way modules work so one can make an http request to load the text of a module into flash and then it's always available? Maybe that's easier.

About

Avatar for tve @tve started