Skip to content

doc: VM module, how to make VM out of scope and free resources (collected by GC)? #3497

Closed as not planned
@rafi16jan

Description

@rafi16jan

📗 API Reference Docs Problem

  • Version: v14.0.0
  • Platform: Linux localhost 4.14.67 Feature Request: HTTP2 node#4 SMP PREEMPT Mon Jan 14 11:28:51 CST 2019 x86_64 Intel(R) Core(TM) i3-7100U CPU @ 2.40GHz GenuineIntel GNU/Linux
  • Subsystem: vm

Location

Section of the site where the content exists

Affected URL(s):

Description

Concise explanation of the problem

I am developing a WASM app that utilizes node's http server and I plan to create a cluster/worker pool that destroys the cluster/worker when WASM memory was grown (is that the correct word?) out of the needed amount. This happen because WASM supports growing memory but not shrinking it, take a look at this issue. My application already utilizes a memory reset logic that works flawlessly, but still the total allocated memory was the last amount of used memory and it jumps especially when there's a huge incoming requests that get in.

A solution would be deleting all variable reference of the WASM Module instance, Memory instance, and etc and let node's GC collect unused resources but emscripten's emit so many global variable that refers to the instances and I think deleting them is complicated. So if we execute the emscripten's JS glue code and the WASM on a VM context, can we make it out of scope (make the GC collects it) since there's no way to destroy it as specified on the docs?


  • I would like to work on this issue and
    submit a pull request.

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