Skip to content

Commit

Permalink
Merge pull request #215 from SimenB/patch-2
Browse files Browse the repository at this point in the history
Add `resetRetrieveHandlers` to avoid memory leak
  • Loading branch information
LinusU committed May 13, 2018
2 parents 07ea55d + d8da098 commit be96fd9
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 be96fd9

Please sign in to comment.