Skip to content

This library provides fast, lightweight and low-level memory allocators for .NET (e.g TLSF)

License

Notifications You must be signed in to change notification settings

XenoAtom/XenoAtom.Allocators

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

XenoAtom.Allocators ci NuGet

This library provides fast, lightweight and low-level memory allocators for .NET.

✨ Features

  • Implementation of a TLSF (Two-Level Segregated Fit) allocator with the following features
    • Implementation of the paper TLSF: a NewDynamic Memory Allocator for Real-Time Systems
    • Provides an agnostic backend chunk allocator architecture (native memory, managed memory, custom e.g GPU memory...)
    • 4GB of addressable maximum allocation size.
    • Minimum allocation size/alignment of 64 bytes (32 bytes overhead per allocation)
    • Configurable power-of-two alignment per allocator instance.
  • NativeAOT compatible.
  • Support for net8.0+

📖 User Guide

For more details on how to use XenoAtom.Allocators, please visit the user guide.

📊 Benchmarks

The benchmark is available in the XenoAtom.Allocators.Bench.

It is comparing the performance of the TLSF allocator against the standard malloc/free from the C runtime library.

The benchmark consists of making 2048 allocations and frees within a range of random sizes between 64, 96, 150, 200, 400, 1024, 4096 bytes.

BenchmarkDotNet v0.13.12, Windows 11 (10.0.22631.3810/23H2/2023Update/SunValley3)
AMD Ryzen 9 7950X, 1 CPU, 32 logical and 16 physical cores
.NET SDK 8.0.300
  [Host]     : .NET 8.0.6 (8.0.624.26715), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI
  DefaultJob : .NET 8.0.6 (8.0.624.26715), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI
Method Mean Error StdDev Ratio RatioSD
Tlsf 82.27 us 1.285 us 1.202 us 0.78 0.02
Libc 105.34 us 1.898 us 2.110 us 1.00 0.00

The benchmark shows that the TLSF allocator is 20%+ faster than the standard malloc/free from the C runtime library (MSVC C Runtime on Windows).

🪪 License

This software is released under the BSD-2-Clause license.

🤗 Author

Alexandre Mutel aka XenoAtom.

About

This library provides fast, lightweight and low-level memory allocators for .NET (e.g TLSF)

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

Languages