by goldenkey · 12y ago · 0 comments
There's a support library for writing freestanding / embedded Rust called rust-core [1]. This library requires that you define a malloc function: it declares
extern { pub fn malloc(size: uint) -> *mut u8; }
However, it doesn't require that the malloc implementation be more than a stub, and as long as I don't allocate memory at any point that works fine.
"I actually do have a malloc function because my Rust standard library needs to link against it"
He hasn't implemented malloc in his kernel yet (except for a stub).
I just want to point that out since women don't get enough cred in our field.
It doesn't lock you into the system allocator. You can LD_PRELOAD your own, and in the past Rust has even shipped with and used jemalloc[1] (though I believe it's not using it at the moment). Furthermore, as alluded to at the end of the article, you can override the compiler's malloc implementation via what Rust calls "lang items" (which are sadly ill-documented).
> He hasn't implemented malloc in his kernel yet (except for a stub).
Rather, Julia hasn't implemented malloc in her kernel yet.
I think you could forgive people for not knowing that Jason and Julia are the same person? (that's what you are implying, right?)