mirror of
https://github.com/UniXNU/NativeMetal.git
synced 2026-11-20 18:37:22 +03:00
Bridge: mimalloc as the global allocator
The runtime allocates and frees on every encoder call; the system allocator's frees from the encoding thread also returned pages to the kernel (madvise). Every allocation of the bridge and the runtime is freed on the Rust side (handles are Box::into_raw and Box::from_raw), so the allocator is the Rust side's alone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012Camiwa7VsPwkhfyscKQ6S
This commit is contained in:
committed by
Sharky Wang
Unverified
parent
c891ece06d
commit
03e04a6726
@@ -11,6 +11,12 @@
|
||||
#[path = "NativeMetalObjects.rs"]
|
||||
pub mod objects;
|
||||
|
||||
/// The runtime allocates and frees on every encoder call (binding tables, recorded calls, tracked uses); mimalloc's thread-local free
|
||||
/// lists take those small blocks for less than the system allocator, whose frees from the encoding thread also gave pages back to the
|
||||
/// kernel (madvise) as they emptied. Every allocation of the bridge and the runtime is the Rust side's own, freed there.
|
||||
#[global_allocator]
|
||||
static ALLOCATOR: mimalloc::MiMalloc = mimalloc::MiMalloc;
|
||||
|
||||
use metal2vulkan::metal::{PixelFormat, PrimitiveType, TextureUsage};
|
||||
use metal2vulkan::pipeline::{ColorAttachmentDescriptor, RenderPipelineDescriptor, StageSource};
|
||||
use metal2vulkan_runtime::{
|
||||
|
||||
Reference in New Issue
Block a user