Are you scheduling the new request on the res.on('close', event? It might be worth printing something when the socket closes, just so you can be sure that you don't have two connections going at the same time.
You could also try printing process.memory().usage before each request to get an idea of memory usage. It's possible that your code is actually allocating memory each time it runs, so eventually there just isn't enough memory to make the HTTPS connection.
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.
Are you scheduling the new request on the
res.on('close',
event? It might be worth printing something when the socket closes, just so you can be sure that you don't have two connections going at the same time.You could also try printing
process.memory().usage
before each request to get an idea of memory usage. It's possible that your code is actually allocating memory each time it runs, so eventually there just isn't enough memory to make the HTTPS connection.