javascript memory leak with requre js and js anonymous functions -
after executing below lines of code, user
object not being collected gc. showing on chrome heap snapshot.
can help?
define("mockmodule", [], function () { function user(name) { var = this; this.name = name; this.column = [{ id: 'xyz' }]; this.createobj(); } user.prototype.createobj = function () { var = this; this.column[0]['formatter'] = outerfunction(that); }; user.prototype.dummymethod = function () { } ; function outerfunction(that) { return function () { return that.dummymethod(that) }; } return { user: user }; }); define("mockmoduleimpl", ["mockmodule"], function (mockmodule) { function init() { var user = new mockmodule.user("hello"); user = null; } return { init: init }; }); require(["mockmoduleimpl"], function (mockmoduleimpl) { mockmoduleimpl.init(); });
Comments
Post a Comment