lodash/lodash — pull request #389 by jayphelps (2013-11-06 02:53:56+00:00)
Title: Fixed memory leak with debounce/throttle arguments and context

Noticed that both underscore and lodash hold onto the arguments and context of the last execution of a debounced/throttled function. This leak can be serious (as is was in my app, retaining a giant DOM tree)

underscore just merged my PR for this https://github.com/jashkenas/underscore/pull/1329

lodash's implementation is quite a bit more complex so let me know if I missed a case. As discussed in the underscore PR, there isn't really a way to test this. (Unless you want me to resort to _.debounce.toString().replace + eval trickery to inject some local scoped tests?)