Skip to content

Commit

Permalink
Add resetRetrieveHandlers to avoid memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB committed Apr 30, 2018
1 parent 07ea55d commit d8da098
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions source-map-support.js
Expand Up @@ -455,6 +455,9 @@ function shimEmitUncaughtException () {
};
}

var originalRetrieveFileHandlers = retrieveFileHandlers.slice(0);
var originalRetrieveMapHandlers = retrieveMapHandlers.slice(0);

exports.wrapCallSite = wrapCallSite;
exports.getErrorSource = getErrorSource;
exports.mapSourcePosition = mapSourcePosition;
Expand Down Expand Up @@ -540,3 +543,11 @@ exports.install = function(options) {
}
}
};

exports.resetRetrieveHandlers = function() {
retrieveFileHandlers.length = 0;
retrieveMapHandlers.length = 0;

retrieveFileHandlers = originalRetrieveFileHandlers.slice(0);
retrieveMapHandlers = originalRetrieveMapHandlers.slice(0);
}

0 comments on commit d8da098

Please sign in to comment.