I have some nested functions like
var freak = function() { var die = function() { ... } die(this); }
As far as I know, the die function will be created (distributed) every time freak called.
Therefore, if freak gets a lot of time, this means that most of the memory will be wasted (it is assumed that die does not use anything from the freak context, in other words, it works fine even if it is allocated only once and shared between several freak calls - thatโs what I meant in vain).
Do I understand correctly? And is it necessary to completely eliminate nested functions?
javascript garbage-collection memory-management memory-leaks
Khanh Nguyen Nov 05 '13 at 0:13 2013-11-05 00:13
source share