Skip to content

c-api: component-model: Function post return, more values #10841

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

MangoPeachGrape
Copy link
Contributor

No description provided.

@MangoPeachGrape MangoPeachGrape requested a review from a team as a code owner May 27, 2025 16:24
@MangoPeachGrape MangoPeachGrape requested review from alexcrichton and removed request for a team May 27, 2025 16:24
This required `wasmtime_component_val_new()`
@MangoPeachGrape MangoPeachGrape force-pushed the c-api/component-model/more branch from d0b7b9c to 5e0aba9 Compare May 27, 2025 16:28
@github-actions github-actions bot added the wasmtime:c-api Issues pertaining to the C API. label May 27, 2025
Copy link
Member

@alexcrichton alexcrichton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this!

Random thought: do you know how we might run asan or something to check for memory leaks in CI? I'm not sure how to do that myself but it'd be nice to ensure that we're not accidentally leaking any memory with this representation anywhere

@alexcrichton alexcrichton added this pull request to the merge queue May 27, 2025
Merged via the queue into bytecodealliance:main with commit 53701b2 May 27, 2025
43 checks passed
@MangoPeachGrape
Copy link
Contributor Author

@alexcrichton I'm not really sure, as the C and Rust allocators are different, right? Would you compile both with LeakSanitizer?
See:
https://doc.rust-lang.org/beta/unstable-book/compiler-flags/sanitizer.html#leaksanitizer
https://clang.llvm.org/docs/LeakSanitizer.html

@MangoPeachGrape MangoPeachGrape deleted the c-api/component-model/more branch May 29, 2025 12:39
@alexcrichton
Copy link
Member

They should both bottom out in malloc and free by default, so I think ASAN might be enough (which IIRC also detects leaks in addition to other things). If LSAN works though that also seems reasonable to me

@pchickey
Copy link
Contributor

pchickey commented Jun 2, 2025

I recently hooked up wasmtime and a C api project (though not wasmtime's C api) to asan to find my own bugs of that sort. I found that I needed to:

  • compile the rust with nightly and RUSTFLAGS=-Zsanitizer=address
  • install and build the C with an llvm/clang toolchain that is relatively recent so the sanitizer is compatible with the information emitted by rustc, since my CI package manager's was too old I used LLVM-20.1 which is the same version rust is using in nightly. I don't have a sense for when rust will drift far enough from that to break something, but it works right now anyway.
  • build the C sources with -fsanitize=address,undefined -fno-omit-frame-pointer cflags
  • set ASAN_SYMBOLIZER_PATH=<install location of LLVM-20.1.0-Linux-X64>/bin/llvm-symbolizer to get symbols in asan's traces

Also, beware that running debug builds of cranelift under asan will be egregiously, obscenely slow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wasmtime:c-api Issues pertaining to the C API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants