Files
reims-vgpu/xtask
Anees Iqbal 565e650907 🆕 Allocate the library's memory with jemalloc on the shipped targets
On x86-64 Linux and arm64 macOS the C API's crate makes jemalloc the global
allocator, so every Rust allocation in the library, metal2vulkan's runtime's
among them, goes through it. FIFO 1's commands allocate memory that the
runtime's threads free, and glibc refills its arena for each such block on
the allocating thread: on ms01's Iris Xe a Finder drag ran at 36 frames/s
under glibc and 42 with jemalloc preloaded into QEMU.

jemalloc's symbols stay prefixed, so QEMU's C code, the drivers and Apple's
frameworks keep the system's malloc. On macOS jemalloc is built with no
malloc zone (the workspace's cargo config), as its zone would otherwise
register ahead of the system's in every host that links the archive whole.
No block crosses between the two allocators: the suspend bytes the host is
handed go back through rvg_bytes_free, and the blocks the Metal platform
gives NSData and dispatch_data to free are malloc's own. Nothing the guest
or the host observes changes.

A Mac's `cargo xtask check` type-checks Linux with no Linux C toolchain, so
it points jemalloc's build script at an empty archive for that target, as it
leaves SDL unbuilt there: nothing links.
2026-10-14 12:41:46 +03:00
..