deno_swc icon indicating copy to clipboard operation
deno_swc copied to clipboard

Unexpected output and possible memory leak

Open Ravenstine opened this issue 2 years ago • 1 comments

It seems strange for these functions to be maintaining state and producing output that isn't expected from the given input.

For instance, manipulation of a string value results in the original input code when printed:

Screen Shot 2021-09-04 at 10 59 29 AM

It appears that code is being kept in memory with seemingly no way to clear it and the span ranges used for each node are simply incremented:

Screen Shot 2021-09-04 at 11 00 00 AM

So the only way I've figured out to properly print a manipulated AST is to manually increment all the start & end values:

Screen Shot 2021-09-04 at 11 21 08 AM

Is this expected? I'm seeing this using deno 1.13.0.

Ravenstine avatar Sep 04 '21 18:09 Ravenstine

Same here. I don't know the internals of swc at all, but wonder if this is related to the compiler instance being cached in swc_wasm/lib.rs

chrisdevereux avatar May 22 '22 16:05 chrisdevereux