C API prevents GC'ing externref values
alexcrichton opened this issue · comments
I'm in the process of trying to update wasmtime-py to the latest C API to weed out any issues ahead of the 20.0.0 release. One test is currently failing which asserts that a value is collected and unreferenced in Python, but it's failing. The general shape is:
- Create a
wasmtime_externref_t
- Put that in
wasmtime_val_t
- Pass that to
wasmtime_func_call
- Run
store.gc()
- Assert that the value has geen gc'd
The problem appears to be here if I'm understanding this correctly. Notably in this location there's no RootScope
so the to_val
, which creates a Rooted<T>
, attaches itself to the Store
directly meaning that it's now un-collect-able.
cc @fitzgen
Subscribe to Label Action
cc @peterhuene
Thus the following users have been cc'd because of the following labels:
- peterhuene: wasmtime:c-api
To subscribe or unsubscribe from this label, edit the .github/subscribe-to-label.json
configuration file.
Yeah that function takes any impl AsContextMut
and it is on callers to provide a suitable context, since that function cannot (it returns a rooted value, so that function can't create the scope, callers must).
So the question is: which caller needs to be updated to add a root scope? I guess wasmtime_func_call
?