fix: add SourceMapConsumer cleanup, handle unmapped and bare stack lines#15
Open
Tejakshaya wants to merge 1 commit into
Open
fix: add SourceMapConsumer cleanup, handle unmapped and bare stack lines#15Tejakshaya wants to merge 1 commit into
Tejakshaya wants to merge 1 commit into
Conversation
…format. SourceMapConsumer was never destroyed, leaking WASM memory and lines with no source map mapping were silently dropped. lines without a method name (file:line:col with trailing space) had leading whitespace in the parsed filenamewhich ended up breaking lookups
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
smc.destroy()after use to free WASM memory allocated bysource-mapfile:line:colstack lines that have no method name (e.g from react native traces)What was wrong and why:
Missing
smc.destroy()<- WASM memory leaksource-map'sSourceMapConsumerallocates WASM memory that must be explicitly freed viadestroy(), the call was missing entirelySilent line drops when source map has no mapping
When
smc.originalPositionFor()returns{ line: null }the code produced zero output for that stack frame, users see gaps in their translated trace with no indication a line was present but unmapped. Now falls back to printing:atmethodName (line N:col)Bare
file:line:collines parsed with leading whitespace in filenameStack traces from React Native include lines like:
main.jsbundle:954:5353
(no method name, trailing space). The existing regex only matched
file:line:col method, these bare lines fell through tostacktrace-parserwhich included leading whitespace in the filename which ended up causingoriginalPositionForto silently fail so added a second regex to reformat these asat <unknown> (file:line:col)