ColinEberhardt/assemblyscript-regex

Potential memory leak?

ColinEberhardt opened this issue · 2 comments

I've been expanding the scope of the benchmark tests, most recently adding a more complex regex (https://github.com/ColinEberhardt/assemblyscript-regex/pull/24/files#diff-42e96713f3210182cc2ac65586ac4e2025e9c8134b31f88b2da3c2f69be5f452R65) to support evaluation of algorithm changes (e.g. NFA => DFA).

However, adding this more complex regex has caused an issue which looks like it could indicate a memory leak:

baseline x 106,495 ops/sec ±1.28% (85 runs sampled)
character class x 35,063 ops/sec ±1.28% (85 runs sampled)
concatenation x 7,934 ops/sec ±1.44% (87 runs sampled)
quantifiers x 14,392 ops/sec ±1.66% (86 runs sampled)
/home/runner/work/assemblyscript-regex/assemblyscript-regex/node_modules/@assemblyscript/loader/umd/index.js:78
      throw Error(`abort: ${getString(memory, msg)} at ${getString(memory, file)}:${line}:${colm}`);
      ^

Error: abort:  at ~lib/rt/tlsf.ts:238:14
    at abort (/home/runner/work/assemblyscript-regex/assemblyscript-regex/node_modules/@assemblyscript/loader/umd/index.js:78:13)
    at ~lib/rt/tlsf/insertBlock (<anonymous>:wasm-function[2]:0x689)
    at ~lib/rt/tlsf/addMemory (<anonymous>:wasm-function[3]:0x8d1)
    at ~lib/rt/tlsf/growMemory (<anonymous>:wasm-function[8]:0xbf6)
    at ~lib/rt/tlsf/allocateBlock (<anonymous>:wasm-function[10]:0xccb)
    at ~lib/rt/tlsf/moveBlock (<anonymous>:wasm-function[17]:0x1836)
    at ~lib/rt/tlsf/reallocateBlock (<anonymous>:wasm-function[18]:0x18ff)
    at ~lib/rt/tlsf/__realloc (<anonymous>:wasm-function[19]:0x1926)
    at ~lib/rt/pure/__renew (<anonymous>:wasm-function[20]:0x1958)
    at ~lib/array/ensureSize (<anonymous>:wasm-function[56]:0x2147)

see the PR: #24

Hey. What's the status on this? Did the new runtime help with this problem?

Good point, yes it did. With the new 0.18 runtime the performance is improved and also I’ve been able to add some more complex regex tests to the benchmark 12c8e55