lrs-lang / lib

An experimental standard library
Mozilla Public License 2.0
224 stars 3 forks source link

Implement an allocator #20

Open mahkoh opened 8 years ago

mahkoh commented 8 years ago

Now that no_libc is fully functional, we should write an allocator for it. Currently, it simply allocates with mmap which is quite inefficient.

mahkoh commented 8 years ago

There is now a thread-local allocator that only depends on mmap. Thread local means that its memory must be de-allocated in the same thread it has been allocated. This is implemented by marking the MemPool !Send.

I have not done any serious benchmarking, but some initial tests make it look somewhat faster than libc. But this is likely because of inlining and not because of some genius design.

Rc now uses this allocator by default.