deno
deno copied to clipboard
Long strings crash typescript import but not javascript import
If I import a file with long strings, it can crash if the same file is Typescript, whereas the Javascript equivalent works fine
const longstring = "r".repeat(100000000)
await Deno.writeTextFile("./foo.js",`export default '{x: "${longstring}" }'`)
await Deno.writeTextFile("./foo.ts",`export default '{x: "${longstring}" }'`)
then import "./foo.js" works but import "./foo.ts" crashes deno:
deno
Deno 1.14.1
exit using ctrl+d or close()
> import "./foo.js"
Module {
default: "{x: rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr..."
}
deno
Deno 1.14.1
exit using ctrl+d or close()
> import "./foo.ts"
Check file:///Users/dan/foo.ts
<--- Last few GCs --->
[36469:0x1301c8000] 19015 ms: Scavenge 1389.3 (1417.1) -> 1388.7 (1421.6) MB, 8.0 / 0.0 ms (average mu = 0.220, current mu = 0.195) allocation failure
[36469:0x1301c8000] 19024 ms: Scavenge 1391.8 (1421.6) -> 1390.4 (1422.3) MB, 5.8 / 0.0 ms (average mu = 0.220, current mu = 0.195) allocation failure
[36469:0x1301c8000] 19034 ms: Scavenge 1392.5 (1422.3) -> 1391.4 (1424.1) MB, 7.4 / 0.0 ms (average mu = 0.220, current mu = 0.195) allocation failure
<--- JS stacktrace --->
#
# Fatal javascript OOM in Ineffective mark-compacts near heap limit
#
[1] 36469 trace trap deno
I'm not fully sure if it's the same problema, but when I run deno check main.ts and this main is the main.ts of a fresh project, I got the same issue
Check file:///Users/igorbrasileiro/dev/deco/deco/main.ts
<--- Last few GCs --->
[1980:0x110418000] 23315 ms: Mark-Compact (reduce) 1396.2 (1433.1) -> 1395.0 (1433.1) MB, 208.00 / 0.00 ms (average mu = 0.249, current mu = 0.262) allocation failure; scavenge might not succeed
[1980:0x110418000] 23562 ms: Mark-Compact (reduce) 1396.0 (1433.1) -> 1395.1 (1433.1) MB, 244.38 / 0.00 ms (average mu = 0.139, current mu = 0.011) allocation failure; scavenge might not succeed
<--- JS stacktrace --->
#
# Fatal JavaScript out of memory: Ineffective mark-compacts near heap limit
#
[1] 1980 trace trap deno check main.ts
Info about deno
$ deno --version
deno 1.39.4 (release, aarch64-apple-darwin)
v8 12.0.267.8
typescript 5.3.3