Looks like wasm module is sandboxed, so you should marshal anything non-trivial. You can return string pointer (ptr member) and store length in an exported global variable. If the caller reads the stored length right upon receiving the return value, it should be fine.