After doing some research on garbage collection in JavaScript, I came across information stating that local variables of functions are collected once the function has returned (except for cyclical references which require breaking circles for the GC to function).
My question is, what exactly does "function returned" mean in this context?
Does it refer to:
The function must return values.
or simply:
The function call has concluded.
In my opinion, 2) seems more logical, but if I am mistaken:
- How does this apply to functions that do not return any values?
- Should I include an empty
return;
statement in functions that do not return anything to ensure the garbage collector is triggered?