Example of a simple allocator

Hi,

I am learning Rust and want to write my own memory allocator.
Are there examples of how to do this - I am looking for bare bones example - how to construct an object after allocating memory. My understanding is that there is no placement new type facility - so the only way is to construct a struct and copy it to the heap memory?

Thanks and Regards
Dibyendu

You could check out the wee_alloc crate, which is often used in Rust WASM projects.

jenga is a bump allocator I wrote some time ago.
Designed for fast allocations that would be placed on the stack in C.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.