Misaki.HighPerformance.LowLevel 1.7.4

dotnet add package Misaki.HighPerformance.LowLevel --version 1.7.4
                    
NuGet\Install-Package Misaki.HighPerformance.LowLevel -Version 1.7.4
                    
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="Misaki.HighPerformance.LowLevel" Version="1.7.4" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Misaki.HighPerformance.LowLevel" Version="1.7.4" />
                    
Directory.Packages.props
<PackageReference Include="Misaki.HighPerformance.LowLevel" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Misaki.HighPerformance.LowLevel --version 1.7.4
                    
#r "nuget: Misaki.HighPerformance.LowLevel, 1.7.4"
                    
#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.
#:package Misaki.HighPerformance.LowLevel@1.7.4
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Misaki.HighPerformance.LowLevel&version=1.7.4
                    
Install as a Cake Addin
#tool nuget:?package=Misaki.HighPerformance.LowLevel&version=1.7.4
                    
Install as a Cake Tool

Misaki.HighPerformance.LowLevel

Unsafe collections, allocators, and memory-management primitives for high-performance C#.

This package is the lowest-level layer in the solution. It is intended for code that needs explicit control over allocation, layout, and ownership.

What it includes

  • unsafe arrays, lists, queues, stacks, hash maps, hash sets, sparse sets, and slot maps
  • arenas and allocation helpers
  • fixed-size text and string primitives
  • memory and unsafe utilities
  • pointer wrappers and function pointers
  • low-level buffer and lifetime management types

Highlights

  • explicit allocation control
  • cache-friendly and allocation-aware data structures
  • APIs suited for systems programming, jobs, and custom runtime components
  • designed to work well with unsafe and AOT-friendly code paths

Main types

  • UnsafeArray<T>
  • UnsafeList<T>
  • UnsafeQueue<T>
  • UnsafeStack<T>
  • UnsafeHashMap<TKey, TValue>
  • UnsafeHashSet<T>
  • UnsafeSparseSet<T>
  • UnsafeSlotMap<T>
  • VirtualArena
  • DynamicArena
  • MemoryPool
  • AllocationManager
  • UnsafeUtility
  • FixedString
  • FixedText

Example

General usage

var opts = new AllocationManagerInitOpts
{
    ArenaCapacity = 1024 * 1024,
    StackCapacity = 1024 * 1024,
};

AllocationManager.Initialize(opts);

var arr = new UnsafeArray<int>(10, AllocationHandle.Persistent);

// Use the array

arr.Dispose();

AllocationManager.Dispose();

Custom memory pool


using var pool = new MemoryPool<TLSF, TLSF.CreationOptions>(new TLSF.CreationOptions { alignment = 16 });
using var array = new UnsafeArray<int>(10, pool.AllocationHandle);

// Use the array

Package reference

dotnet add package Misaki.HighPerformance.LowLevel

Notes

This project targets net10.0, enables unsafe code, and is packaged as content files for downstream consumption.

You can enable debug features for leak detection and use-after-free checks by defining MHP_ENABLE_SAFETY_CHECKS in your project. And define MHP_ENABLE_STACKTRACE to enable additional debug features such as tracking allocations and providing detailed error messages.

If you disable the safety checks, the library will not perform any safety checks, including bounds checking, and provide the maximum performance, and it will be your responsibility to ensure correct usage to avoid memory leaks and undefined behavior. Even IUnsafeCollection.IsCreated will only check if the internal pointer is non-null, without verifying the actual validity of the memory.

You can also define MHP_ENABLE_MIMALLOC to use mimalloc as the underlying allocator instead of the default C allocator.

Using mimalloc requires to install the TerraFX.Interop.Mimalloc package.

There are no supported framework assets in this 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
1.7.4 117 5/28/2026
1.7.3 115 5/15/2026
1.7.2 104 5/15/2026
1.7.1 108 5/12/2026
1.7.0 119 5/11/2026
1.6.26 124 5/10/2026
1.6.25 122 5/10/2026
1.6.24 120 5/7/2026
1.6.23 112 5/7/2026
1.6.22 122 5/6/2026
1.6.21 116 5/5/2026
1.6.20 118 5/5/2026
1.6.19 114 5/5/2026
1.6.18 124 5/4/2026
1.6.17 132 5/4/2026