Comment on A surprising JavaScript memory leak found at MeteorparentComments−glasserOP13yTo be clear: when you say "removing the call to doSomethingWithStr() doesn't change the unbounded memory growth" you do literally mean "removing the call" and not "removing the function definition", right? That matches what I see.−mayank13yCorrect. I'm actually a little surprised that an identity statement like "str;" isn't optimized out.Edit: removing the function definition eliminates the problem, so I'd say that your diagnosis of the problem is spot on.
Comments
To be clear: when you say "removing the call to doSomethingWithStr() doesn't change the unbounded memory growth" you do literally mean "removing the call" and not "removing the function definition", right? That matches what I see.
Correct. I'm actually a little surprised that an identity statement like "str;" isn't optimized out.
Edit: removing the function definition eliminates the problem, so I'd say that your diagnosis of the problem is spot on.