Well, so the history has the whole program text as a string. The entire function sendTemp can be found in another string. Then the callback of http.request (the string starting with resp.on('data', ...) can be found as a string in the #onconnect of the http connection array. Within that, the data and the close callbacks can be found yet again in the resp object. So if I look at the if statement f (!gotErr && resp.statusCode !== "200") console.log("Got HTTP code", resp.statusCode); that's present 4 times in memory! Yikes!
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.
Mhh, I'm also noticing that anonymous functions are evil from a space perspective. In my little test code I have:
Well, so the history has the whole program text as a string. The entire function sendTemp can be found in another string. Then the callback of http.request (the string starting with
resp.on('data', ...
) can be found as a string in the #onconnect of the http connection array. Within that, the data and the close callbacks can be found yet again in the resp object. So if I look at the if statementf (!gotErr && resp.statusCode !== "200") console.log("Got HTTP code", resp.statusCode);
that's present 4 times in memory! Yikes!