Stream: wasmtime

Topic: How wasm_byte_vec_delete frees memory


view this post on Zulip Cheng Shao (May 02 2021 at 08:37):

Hi all, I'm working on Haskell bindings of wasmtime and got a question about wasm_byte_vec_delete. It should only free the memory pointed by the data field, not the wasm_byte_vec_t struct itself right? Usually when the C API wants to pass a bytestring as a result, it expects the caller to provide space for the wasm_byte_vec_t, but there are cases where the C API directly return a pointer to wasm_byte_vec_t (e.g. wasmtime_frame_func_name). In that case, how do I free the struct's memory? Sounds like a minor source of leak to me, but I hope I'm wrong :)

view this post on Zulip Cheng Shao (May 02 2021 at 10:03):

Never mind, just found in the documentation that the returned names are owned by the frame and shouldn't be deallocated manually


Last updated: Nov 22 2024 at 16:03 UTC