Skip to content

Template literals cause GC crash #2178

Closed
@HerrCai0907

Description

@HerrCai0907

code like this, after serval times running, wasm will crash

@global const ASC_GC_SWEEPCOST: i32 = 1000;  // make sweep bigger so the bug will easier to be reproduced

function randomNew(): void {
  trace("test");
  const a = Math.random();
  `bbbbbbb${a.toString()}bb`;
}

for (;;) {
  randomNew();
}

Error: abort: at ~lib/rt/itcms.ts:228:20
at abort (/home/ccc/Desktop/test/as/node_modules/@assemblyscript/loader/umd/index.js:105:13)
at ~lib/rt/itcms/step (wasm-function[42]:0x21cd)
at ~lib/rt/itcms/interrupt (wasm-function[43]:0x220f)
at ~lib/rt/itcms/__new (wasm-function[54]:0x279e)
at ~lib/util/number/dtoa (wasm-function[71]:0x2b7d)
at ~lib/number/F64#toString (wasm-function[55]:0x27e0)
at assembly/index/randomNew (wasm-function[70]:0x2a5c)
at start:assembly/index (wasm-function[62]:0x28ea)
at ~start (wasm-function[68]:0x29b3)
at Object.curr. [as _start] (/home/ccc/Desktop/test/as/node_modules/@assemblyscript/loader/umd/index.js:545:20)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions