Skip to content

This is the educational project. I am trying to rewrite mimalloc allocator https://microsoft.github.io/mimalloc into the Rust. Let's start the journey :)

License

Notifications You must be signed in to change notification settings

rustatian/mimallocator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mimalloc-rs

This is the educational project. I am trying to rewrite mimalloc allocator link into the Rust. Let's start the journey :)

Some Rust problems which I got during the implementation:

  1. rust-lang/rust#49804 + GCC. Rust doesn't support unnamed(anonymous) struct/union fields at the time. For example on union in C:
typedef union mi_page_flags_s {
  uint8_t full_aligned;
  struct {
    uint8_t in_full : 1;
    uint8_t has_aligned : 1;
  } x;
} mi_page_flags_t;

Rewrites into 2 types in Rust. It's not really a problem, just note:

#[repr(C)]
#[derive(Copy, Clone)]
union MiPageFlagsT {
    full_aligned: u8,
    x: X,
}

#[derive(Copy, Clone)]
struct X {
    in_full: bool,
    has_aligned: bool,
}
  1. Preprocessor features: Rust_Forum

C: (just sample)

#if INTPTR_MAX == 9223372036854775807LL
# define A (3)
#else A(2)

Rust: Might be I don't have enough Rust knowledge at the moment to re-implement such features in Rust.

About

This is the educational project. I am trying to rewrite mimalloc allocator https://microsoft.github.io/mimalloc into the Rust. Let's start the journey :)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages