-
• #2
The "undefined" looks normal, as you're printing to the console the result of wifi.ping() which doesn't return anything.
The memory hemorrhage, though... 85 jsvars per iteration!
-
• #3
Ok, I just made a change which will hopefully fix it (looks like the ping responses were causing leaks) - so hopefully cutting edge builds will have this fixed.
-
• #5
can confirm that fix is working as expected
test snippet:
var Wifi = require("Wifi"); var i = 1; var sleep = 7000; setInterval(function(){ console.log("run:",i++); Wifi.ping("192.168.194.1", function(rc){ console.log("ping result",rc); }); console.log("process.memory().free",process.memory().free); },sleep);
output:
run: 1 process.memory().free 1524 ping result { "totalCount": 0, "totalBytes": 0, "totalTime": 0, "respTime": 20, "seqNo": 341, "timeoutCount": 0, "bytes": 32, "error": 0 } ping result { "totalCount": 0, "totalBytes": 0, "totalTime": 0, "respTime": 0, "seqNo": 0, "timeoutCount": 0, "bytes": 0, "error": -1 } ping result { "totalCount": 0, "totalBytes": 0, "totalTime": 0, "respTime": 11, "seqNo": 343, "timeoutCount": 0, "bytes": 32, "error": 0 } ping result { "totalCount": 0, "totalBytes": 0, "totalTime": 0, "respTime": 3, "seqNo": 344, "timeoutCount": 0, "bytes": 32, "error": 0 } ping result { "totalCount": 0, "totalBytes": 0, "totalTime": 0, "respTime": 0, "seqNo": 0, "timeoutCount": 0, "bytes": 0, "error": -1 } run: 2 process.memory().free 1524 ping result { "totalCount": 0, "totalBytes": 0, "totalTime": 0, "respTime": 0, "seqNo": 0, "timeoutCount": 0, "bytes": 0, "error": -1 } ping result { "totalCount": 0, "totalBytes": 0, "totalTime": 0, "respTime": 0, "seqNo": 0, "timeoutCount": 0, "bytes": 0, "error": -1 } ping result { "totalCount": 0, "totalBytes": 0, "totalTime": 0, "respTime": 27, "seqNo": 348, "timeoutCount": 0, "bytes": 32, "error": 0 } ping result { "totalCount": 0, "totalBytes": 0, "totalTime": 0, "respTime": 1, "seqNo": 349, "timeoutCount": 0, "bytes": 32, "error": 0 } ping result { "totalCount": 0, "totalBytes": 0, "totalTime": 0, "respTime": 1, "seqNo": 350, "timeoutCount": 0, "bytes": 32, "error": 0 } run: 3 process.memory().free 1524 ping result { "totalCount": 0, "totalBytes": 0, "totalTime": 0, "respTime": 6, "seqNo": 351, "timeoutCount": 0, "bytes": 32, "error": 0 } ping result { "totalCount": 0, "totalBytes": 0, "totalTime": 0, "respTime": 1, "seqNo": 352, "timeoutCount": 0, "bytes": 32, "error": 0 } ping result { "totalCount": 0, "totalBytes": 0, "totalTime": 0, "respTime": 1, "seqNo": 353, "timeoutCount": 0, "bytes": 32, "error": 0 } ping result { "totalCount": 0, "totalBytes": 0, "totalTime": 0, "respTime": 4, "seqNo": 354, "timeoutCount": 0, "bytes": 32, "error": 0 } ping result { "totalCount": 0, "totalBytes": 0, "totalTime": 0, "respTime": 2, "seqNo": 355, "timeoutCount": 0, "bytes": 32, "error": 0 } run: 4 process.memory().free 1524 ping result { "totalCount": 0, "totalBytes": 0, "totalTime": 0, "respTime": 5, "seqNo": 356, "timeoutCount": 0, "bytes": 32, "error": 0 } ping result { "totalCount": 0, "totalBytes": 0, "totalTime": 0, "respTime": 2, "seqNo": 357, "timeoutCount": 0, "bytes": 32, "error": 0 } ping result { "totalCount": 0, "totalBytes": 0, "totalTime": 0, "respTime": 2, "seqNo": 358, "timeoutCount": 0, "bytes": 32, "error": 0 } ping result { "totalCount": 0, "totalBytes": 0, "totalTime": 0, "respTime": 2, "seqNo": 359, "timeoutCount": 0, "bytes": 32, "error": 0 } ping result { "totalCount": 0, "totalBytes": 0, "totalTime": 0, "respTime": 1, "seqNo": 360, "timeoutCount": 0, "bytes": 32, "error": 0 } run: 5 process.memory().free 1524 ping result { "totalCount": 0, "totalBytes": 0, "totalTime": 0, "respTime": 9, "seqNo": 361, "timeoutCount": 0, "bytes": 32, "error": 0 } ping result { "totalCount": 0, "totalBytes": 0, "totalTime": 0, "respTime": 3, "seqNo": 362, "timeoutCount": 0, "bytes": 32, "error": 0 } ping result { "totalCount": 0, "totalBytes": 0, "totalTime": 0, "respTime": 2, "seqNo": 363, "timeoutCount": 0, "bytes": 32, "error": 0 } ping result { "totalCount": 0, "totalBytes": 0, "totalTime": 0, "respTime": 3, "seqNo": 364, "timeoutCount": 0, "bytes": 32, "error": 0 } ping result { "totalCount": 0, "totalBytes": 0, "totalTime": 0, "respTime": 2, "seqNo": 365, "timeoutCount": 0, "bytes": 32, "error": 0 }
-
• #6
Problem with memory leak in wifi.ping() still exist.
espruino_1v99_esp8266
Where I can get fixed version?
run: 1 process.memory().free 1592 ping result { "totalCount": 0, "totalBytes": 0, "totalTime": 0, "respTime": 83, "seqNo": 1, "timeoutCount": 0, "bytes": 32, "error": 0 } ping result { "totalCount": 0, "totalBytes": 0, "totalTime": 0, "respTime": 10, "seqNo": 2, "timeoutCount": 0, "bytes": 32, "error": 0 } ping result { "totalCount": 0, "totalBytes": 0, "totalTime": 0, "respTime": 7, "seqNo": 3, "timeoutCount": 0, "bytes": 32, "error": 0 } ping result { "totalCount": 0, "totalBytes": 0, "totalTime": 0, "respTime": 7, "seqNo": 4, "timeoutCount": 0, "bytes": 32, "error": 0 } ping result { "totalCount": 0, "totalBytes": 0, "totalTime": 0, "respTime": 7, "seqNo": 5, "timeoutCount": 0, "bytes": 32, "error": 0 } run: 2 process.memory().free 1507 ping result { "totalCount": 0, "totalBytes": 0, "totalTime": 0, "respTime": 11, "seqNo": 6, "timeoutCount": 0, "bytes": 32, "error": 0 } ping result { "totalCount": 0, "totalBytes": 0, "totalTime": 0, "respTime": 8, "seqNo": 7, "timeoutCount": 0, "bytes": 32, "error": 0 } ping result { "totalCount": 0, "totalBytes": 0, "totalTime": 0, "respTime": 7, "seqNo": 8, "timeoutCount": 0, "bytes": 32, "error": 0 } ping result { "totalCount": 0, "totalBytes": 0, "totalTime": 0, "respTime": 7, "seqNo": 9, "timeoutCount": 0, "bytes": 32, "error": 0 } ping result { "totalCount": 0, "totalBytes": 0, "totalTime": 0, "respTime": 8, "seqNo": 10, "timeoutCount": 0, "bytes": 32, "error": 0 } run: 3 process.memory().free 1422 ping result { "totalCount": 0, "totalBytes": 0, "totalTime": 0, "respTime": 10, "seqNo": 11, "timeoutCount": 0, "bytes": 32, "error": 0 } ping result { "totalCount": 0, "totalBytes": 0, "totalTime": 0, "respTime": 8, "seqNo": 12, "timeoutCount": 0, "bytes": 32, "error": 0 }
-
• #7
You have to download the Travis build to get this fix
-
• #8
What is the Travis build? Where I can get it?
-
• #9
I have found Travis build, thank you!
-
• #10
👍🏻
-
• #11
Check this file for all latest changes
https://github.com/espruino/Espruino/blob/master/ChangeLog -
• #12
Thank you, MaBe!
Hello.
I use wifi.ping wifi.ping with setInterval under v1.96 and NodeMCU, it have memory leak in case if I use callback function and function wifi.ping always return undefined. See code and result below.
How it's may be solve? I need to have result of ping: successful or fail, without check of callback argument, in this case memory leak will not present.
result: