3 ms·
Rust does have dynamic heap allocation. I'm writing freestanding Rust (using #[no_std]). This means that I can compile Rust code without using the normal standa
by jvns 13y ago
Rust does have dynamic heap allocation. I'm writing freestanding Rust (using #[no_std]). This means that I can compile Rust code without using the normal standard library, and makes it possible to do things like write a kernel in Rust (which is my use case right now).
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.
[1]http://github.com/thestinger/rust-core http://github.com/thestinger/rust-core