Can I somehow share memory between dependency modules? #2363
-
I've gone through Multiple Modules As Dependencies page and tried to make my own dependencies, but found that I can't simply pass buffer from a main module to a submodule. In particular, I have this two piece of code:
and
And it seems that worker only sees zeros instead of the actual data. I've created the buffer with |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Because every instance has its own liner memory in this case, worker can not see the content in main's memory directly. Using |
Beta Was this translation helpful? Give feedback.
Because every instance has its own liner memory in this case, worker can not see the content in main's memory directly.
Using
wasm_runtime_module_malloc
is one possible way. It needs additional help from host. In that scenario, host will manage the lifecyle ofmas
(allocation and release). Host will dispatchmas
toworker
and other processores(if exist).