On Wed, Aug 27, 2025 at 02:41:24PM +0400, marcandre.lur...@redhat.com wrote:
> Date: Wed, 27 Aug 2025 14:41:24 +0400
> From: marcandre.lur...@redhat.com
> Subject: [PATCH 02/22] rust: remove unused global qemu "allocator"
> 
> From: Marc-André Lureau <marcandre.lur...@redhat.com>
> 
> The global allocator has always been disabled. There is no clear reason
> Rust and C should use the same allocator. Allocations made from Rust
> must be freed by Rust, and same for C, otherwise we head into troubles.
> 
> Signed-off-by: Marc-André Lureau <marcandre.lur...@redhat.com>
> ---
>  meson.build               |   4 --
>  rust/Cargo.toml           |   2 +-
>  rust/qemu-api/Cargo.toml  |   1 -
>  rust/qemu-api/meson.build |   1 -
>  rust/qemu-api/src/lib.rs  | 135 --------------------------------------
>  5 files changed, 1 insertion(+), 142 deletions(-)

There's a discussion almost one years ago:

https://lore.kernel.org/qemu-devel/cabgobfyy1prd9drkrgzgyrae8gzp-4khvv1-bgq32_2jpat...@mail.gmail.com/#t

Now we have libc crate and have an example which allocates the C structure
at Rust side:

let err: *mut c_void = libc::malloc(std::mem::size_of::<bindings::Error>());

this indeed seems simpler than enabling QemuAllocator.

So it's fine for me to remove this allocator:

Reviewed-by: Zhao Liu <zhao1....@intel.com>


let's see if Paolo & Manos have other comment.



Reply via email to