yeah that's what i thought. if i declare a global "street" variable, set it in the menu handler and use setInterval in the main to detect for the variable being set then it effectively frees the menu's memory. however i expected it to be also true if using a setTimeout in the handler itself since i thought the timeout's function would not be associated with the menu (the menu's handler registers the timeout and completes) and this is not the case.
so i have the setInterval workaround which is fine, i'm not stuck but somehow it still don't get why the garbage collector is not freeing the memory if i use a timeout.
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.
yeah that's what i thought. if i declare a global "street" variable, set it in the menu handler and use setInterval in the main to detect for the variable being set then it effectively frees the menu's memory. however i expected it to be also true if using a setTimeout in the handler itself since i thought the timeout's function would not be associated with the menu (the menu's handler registers the timeout and completes) and this is not the case.
so i have the setInterval workaround which is fine, i'm not stuck but somehow it still don't get why the garbage collector is not freeing the memory if i use a timeout.