Extremely high memory usage
johannesjo opened this issue · 5 comments
For a larger codebase with framework code (angular) I am using this module. When several errors are thrown and several stracktraces are requested in a short succession memory usage spikes absolutely out of control.
Expected Behavior
Should require a little bit less memory per error.
Current Behavior
Memory spikes out of control.
This is how stacktraces are requested.
StackTrace.fromError(err)
.then((stackframes) => {
return stackframes
.splice(0, 20)
.map((sf) => {
return sf.toString();
}).join('\n');
});
@johannesjo would you mind attaching a snippet or unit test that would reproduce this issue so we could profile it.
This line could be the culprit of high memory usage:
stacktrace.js/dist/stacktrace.js
Line 2527 in c12fccd
A big source file will be splitted each time a function name must be found.
Imagine what happen with a source file of 10Mb and a stacktrace with hundred of function names.
we have had browser crashes recently when using the stack trace grabbing functionality - as well as performance issues when gathering stack traces.
Would you mind submitting a pr with a fix, perhaps info could be cached.
i noticed that my .map file was 111megabytes, by reworking my webpack.config i was able to get it down to 1mb and i think that is helping reduce the amount of crashing thats going on.
to those in this boat, see if you can split your bundles to be smaller
https://medium.com/hackernoon/the-100-correct-way-to-split-your-chunks-with-webpack-f8a9df5b7758
