Mhh, to me it looks like connection objects just don't get freed. After running one HTTP request I see the following if I do a trace():
1[r2,l1] Object { #2[r1,l2] Name String [1 blocks] "ÿ" #3[r1,l2] Object { #6[r1,l2] Name String [2 blocks] "timers" #8[r2,l1] Array(0) [ ] #9[r1,l2] Name String [2 blocks] "watches" #11[r2,l1] Array(0) [ ] #14[r1,l2] Name String [1 blocks] "net" #12[r1,l2] String [2 blocks] "\x04\x00\x00\x00\x00ÿÿÿ" #15[r1,l2] Name String [2 blocks] "history" #19[r1,l1] Array(2) [ #20[r1,l2] Name Integer 0 #16[r1,l1] String [2 blocks] "echo(0);" #56[r1,l2] Name Integer 1 #36[r1,l1] String [16 blocks] "setTime(1.450337081404E9);var postUrl=\"http://h.voneicken.com:4567/temp\";var http=require(\"http\");var int1,int2;var errCnt=0;var okCnt=0;" ] #26[r1,l2] Name String [2 blocks] "modules" #24[r1,l1] Object { #27[r1,l2] Name String [1 blocks] "http" #23[r2,l1] ... } #297[r1,l2] Name String [2 blocks] "HttpCC" #299[r1,l1] Array(1) [ #332[r1,l2] Name Integer 0 #324[r2,l1] Object { #325[r1,l2] Name String [2 blocks] "__proto__" #320[r2,l1] ... #329[r1,l2] Name String [1 blocks] "type"= int 1 #328[r1,l2] Name String [2 blocks] "#onconnect" #264[r1,l1] Function { #265[r1,l2] Name Param "resp" undefined #295[r1,l2] Name String [1 blocks] "ÿcod" #266[r1,l1] FlatString [29 blocks] "resp.on(\"data\",function(d){if(d!==\"OK\")console.log(\"Got unexpected response:\",d)});resp.on(\"close\",function(gotErr){if(!gotErr&&resp.statusCode!==\"200\")console.log(\"Got HTTP code\",resp.statusCode);if(gotErr||resp.statusCode!==\"200\")errCnt++;else okCnt++});resp.on(\"error\",function(err){console.log(\"HTTP response error: \",err.message)})"
I thought the connection gets removed from the HttpCC array here: https://github.com/espruino/Espruino/blob/master/libs/network/socketserver.c#L548 and I verified with a printf that this indeed gets executed. I must not be understanding something correctly...
@tve started
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, to me it looks like connection objects just don't get freed. After running one HTTP request I see the following if I do a trace():
I thought the connection gets removed from the HttpCC array here: https://github.com/espruino/Espruino/blob/master/libs/network/socketserver.c#L548 and I verified with a printf that this indeed gets executed. I must not be understanding something correctly...