Using a global_allocator with rules_rust #3371
Unanswered
DolceTriade
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello!
Has anyone successfully compiled using a global allocator (jemalloc) using bazel?
I was trying to figure out why jemalloc didn't see any allocations until I dug into rules_rust and found that it doesn't handle
#[global_allocator]
the same way as regular rust.I have a hobby (OSS) BEP visualization app I'm trying to improve to find some memory leaks and was hoping to utilize jemalloc to do so. But it's a weird app in that its compiled both to a native target and to wasm using Leptos. So I want the native version to use a custom global allocator but not the wasm stuff (which has the same code with slightly different features).
However, when I try to enable
experimental_use_cc_common_link
, I start getting a bunch of undefined references:(Here is a small snippet but there are a lot. Most of them seem to be prost related, so I'm hoping that if I resolve the prost related ones, I can make more progress.
One thing I notice is that the
.a
prost libraries created withrust_prost_library
do not seem to make it to the final binary in the link params if they are a transitive dependency of the final binary. (That said, forcibly making them a dependency of the final binary does not seem to help either).Is this expected behavior and I need to do more to work around this issue?
Beta Was this translation helpful? Give feedback.
All reactions