XenoAtom.Allocators 3.1.0

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package XenoAtom.Allocators --version 3.1.0                
NuGet\Install-Package XenoAtom.Allocators -Version 3.1.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="XenoAtom.Allocators" Version="3.1.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add XenoAtom.Allocators --version 3.1.0                
#r "nuget: XenoAtom.Allocators, 3.1.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install XenoAtom.Allocators as a Cake Addin
#addin nuget:?package=XenoAtom.Allocators&version=3.1.0

// Install XenoAtom.Allocators as a Cake Tool
#tool nuget:?package=XenoAtom.Allocators&version=3.1.0                

XenoAtom.Allocators ci NuGet

<img align="right" width="160px" height="160px" src="https://raw.githubusercontent.com/XenoAtom/XenoAtom.Allocators/main/img/XenoAtom.Allocators.png">

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.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
3.2.0 125 7/14/2024
3.1.0 98 7/14/2024
3.0.0 114 7/6/2024
2.0.0 94 7/5/2024
1.0.0 99 7/5/2024