Skip to content

fix: add SourceMapConsumer cleanup, handle unmapped and bare stack lines#15

Open
Tejakshaya wants to merge 1 commit into
mifi:masterfrom
Tejakshaya:fix/source-map-cleanup-and-line-handling
Open

fix: add SourceMapConsumer cleanup, handle unmapped and bare stack lines#15
Tejakshaya wants to merge 1 commit into
mifi:masterfrom
Tejakshaya:fix/source-map-cleanup-and-line-handling

Conversation

@Tejakshaya

@Tejakshaya Tejakshaya commented Jun 24, 2026

Copy link
Copy Markdown
  • Call smc.destroy() after use to free WASM memory allocated by source-map
  • Show unmapped positions instead of silently dropping stack lines with no source map entry
  • Handle file:line:col stack lines that have no method name (e.g from react native traces)
  • Remove leftover dev comment

What was wrong and why:

  1. Missing smc.destroy() <- WASM memory leak
    source-map's SourceMapConsumer allocates WASM memory that must be explicitly freed via destroy(), the call was missing entirely

  2. Silent 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)

  3. Bare file:line:col lines parsed with leading whitespace in filename
    Stack 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 to stacktrace-parser which included leading whitespace in the filename which ended up causing originalPositionFor to silently fail so added a second regex to reformat these as at <unknown> (file:line:col)

…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant