Stream: git-wasmtime

Topic: wasmtime / issue #3308 Question about the lifetime of Sto...


view this post on Zulip Wasmtime GitHub notifications bot (Sep 07 2021 at 08:17):

spacewander opened issue #3308:

Hi, I am studying the API of wasmtime.
I notice that there are some notes about Store: https://docs.wasmtime.dev/api/wasmtime/struct.Store.html

A Store is intended to be a short-lived object in a program. No form of GC is implemented at this time so once an instance is created within a Store it will not be deallocated until the Store itself is dropped.

I am curious about what is the scope of the "GC", does it cover:

And is there any documentation about the memory management inside the wasm runtime?

Thanks for your reply!

view this post on Zulip Wasmtime GitHub notifications bot (Sep 07 2021 at 08:42):

bjorn3 commented on issue #3308:

It covers things like instances, memories and tables. Instances contain references to module-level globals. Variables used in wasm functions are stored on the stack and are thus deallocated as soon the respective function returns.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 08 2021 at 08:39):

spacewander commented on issue #3308:

Thanks. Are there any docs about the wasmtime's memory management mechanism?

view this post on Zulip Wasmtime GitHub notifications bot (Sep 08 2021 at 13:59):

alexcrichton commented on issue #3308:

The only form of memory management in Wasmtime itself is an implementation of reference counting for ExternRef with optimizations in wasm code itself do to less reference counting. Other than that all memory management in Wasmtime is like malloc/free in normal Rust, calling functions may allocation and dropping things deallocates them.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 09 2021 at 03:07):

spacewander commented on issue #3308:

I see. Thanks.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 09 2021 at 03:07):

spacewander closed issue #3308:

Hi, I am studying the API of wasmtime.
I notice that there are some notes about Store: https://docs.wasmtime.dev/api/wasmtime/struct.Store.html

A Store is intended to be a short-lived object in a program. No form of GC is implemented at this time so once an instance is created within a Store it will not be deallocated until the Store itself is dropped.

I am curious about what is the scope of the "GC", does it cover:

And is there any documentation about the memory management inside the wasm runtime?

Thanks for your reply!


Last updated: Dec 23 2024 at 12:05 UTC