You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • If you get Execution Interrupted then something would have stopped working halfway though. It silently deletes history before complaining about low memory.

    Low free heap wouldn't have caused that error.

    My guess is that res.end(page); is what's causing the problem - as the page is pretty big, and is just being appended to the output buffer, you're basically doubling your memory usage when a page is requested.

    As such, even if you put the page into flash memory this might help for now, but you'll still hit this problem if you make the page much bigger.

    There's some example code on the internet page showing how you can use the drain event to supply data one bit at a time, and you could do that - serving out a few hundred bytes at a time.

    But for you, the simplest solution would actually be to have 2 files - one script and one HTML. You then include the JS from the HTML file, and serve up the 2 different files in onPageRequest.

About

Avatar for Gordon @Gordon started