DEV Community

Discussion on: Run a function periodically in vanilla Javascript

Collapse
 
singh1114 profile image
Ranvir Singh

@asolace I don't think so, all the variables are initialized inside the tellTime function. So, they should be used only when the program runs after each instance. Once the function ends, the garbage collector should remove them from the heap.

stackoverflow.com/questions/140341...

Collapse
 
singh1114 profile image
Ranvir Singh

@asolace @alexandrusimandi updated the post ranvir.xyz/blog/running-a-function... with the answer to the memory leak. Hope it helps.