Skip to content

Continuous memory growth in jco component #350

Description

@ludfjig

Repeatedly calling an export on one ComponentizeJS instance causes continuous RSS growth and shows no signs of stabilizing. Small repro can be found here https://github.com/ludfjig/jco_leak where the compoentnt exports echo: func(value: list<u8>) -> list<u8>; and is repeatendly called.

With ComponentizeJS 0.22.0:

iteration,rss_mib
0,74.1
10000,266.9
20000,365.4
30000,486.5
40000,611.9
50000,676.1
60000,783.1
70000,898.9
80000,938.0
90000,1056.0
100000,1145.4

Note that ComponentizeJS 0.19.3 does NOT repro the bug as you can see it stabilized on 188.9MiB:

iteration,rss_mib
0,70.2
10000,162.6
20000,188.4
30000,188.8
40000,188.9
50000,188.9
60000,188.9
70000,188.9
80000,188.9
90000,188.9
100000,188.9

I believe the bug was introduced in #319.

Note: I reported a similar bug in #279 and fixed it in #295.

Activity

  1. vados-cosmonic commented on Sep 16, 2026

    @vados-cosmonic
    Contributor

    Hey @andreiltd was this still around? Did we need more fixes than what went into Jco? Happy to help if it's something on the Jco side that is holding this up

  2. andreiltd commented on Sep 16, 2026

    @andreiltd
    Member

    Hey @vados-cosmonic, I need to integrate js-component-bindgen changes back to ComponentizeJS. See: #353.

    Coming from bindgen 1.x to 2.1.10 I had to come up with a workaround for "undefined task" error and created this Embedding adapter. I think cleaner solution would be to have something like CallRuntime in js-component-bindgen that will allow to set .call_runtime(CallRuntime::Embedding)  and pass  FunctionBindgen  directly to  abi::call skipping jco task machinery. But the adapter seems to work for now.

  3. vados-cosmonic commented on Sep 16, 2026

    @vados-cosmonic
    Contributor

    Ohhh, OK got it, thank you for the explanation! Oh yeah that would be a cleaner solution, if you want to PR it in I'm happy to take a look! I wonder how widespread those changes would be, threading the option through everywhere, probably wouldn't be too bad.

  4. andreiltd commented on Sep 16, 2026

    @andreiltd
    Member

    Yeah, I can give it a try and see :)

  5. vados-cosmonic commented on Sep 16, 2026

    @vados-cosmonic
    Contributor

    Yeah if we can get that out fast enough we could merge & release that instead of the duplicated Embedder logic? I'm a bit wary/want to try the code in https://github.com/bytecodealliance/ComponentizeJS/pull/353/changes against Jco's test suite since we're overriding bindgen in a few spots.

    [EDIT] I can definitely get a js-component-bindgen release out today if the PR goes up!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions