Varena 1.1.0
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package Varena --version 1.1.0
NuGet\Install-Package Varena -Version 1.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="Varena" Version="1.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Varena --version 1.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Varena, 1.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 Varena as a Cake Addin #addin nuget:?package=Varena&version=1.1.0 // Install Varena as a Cake Tool #tool nuget:?package=Varena&version=1.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Varena
<img align="right" width="160px" height="160px" src="img/varena.png">
Varena is a .NET library that provides a fast and lightweight arena allocator using virtual memory.
Features
- Create very large continuous byte buffers and arrays (e.g 1 TiB) of data without committing the virtual memory to the physical memory.
- Only use the memory that is allocated, not the total capacity reserved!
- Fast bump allocator with a commit per block (default is 64 KiB of memory committed)
- Use
VirtualBuffer
for manipulating bytes. - Use
VirtualArray<T>
for manipulating a dynamic array of unmanaged data. - Compatible with
.NET6.0+
and on all platforms (Windows, Linux, macOS)
Usage
using Varena;
// The manager keeps track of all created arenas (buffers, arrays)
using var manager = new VirtualArenaManager();
// Create a byte buffer and reserve 1 GiB of continuous memory (but not yet allocated)
var arena1 = manager.CreateBuffer("Arena1", 1 << 30);
// Allocate 1024 bytes -> The arena commits a block 64 KiB of memory (configurable)
var span = arena1.AllocateRange(1024);
span[0] = 1;
// Allocate 2048 bytes -> The arena keeps allocating in the previous commit block of 64 KiB
var span2 = arena1.AllocateRange(2048);
span2[0] = 1;
// Create a data array and reserve 1 MiB of continuous memory (but not yet allocated)
var arena2 = manager.CreateArray<Guid>("Arena2", 1 << 20);
// Allocate sizeof(Guid) * 1024 bytes -> The arena commits a block 64 KiB of memory (configurable)
var span3 = arena2.AllocateRange(1024);
span3[0] = Guid.NewGuid();
Documentation
You will find more details about how to use Varena in this user guide.
License
This software is released under the BSD-Clause 2 license.
Author
Alexandre Mutel aka xoofx.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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.
-
net6.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.