No, at most two instances of function’s local data will be held in memory at any given point in time. Here is the order of events:
animate(0)is called.- A closure with
param == 0is created, it now prevents this variable from being released. - Timeout fires,
animate(1)is called. - New closure with
param == 1is created, it now prevent this variable from being released. - The first closure finishes executing, at this point it is no longer referenced and can be released. The local variables from the first
animate()call can also be released now. - Repeat starting with step 3, now with
animate(2).