Skip to content

Repository files navigation

Memory.Extensions NuGet

Memory utils for convenient work with memory, arrays and pointers.
The library is mainly intended for use with native code, such as C++ or in conjunction with Native AOT. All actions are carried out with the heap, all allocated pointers do not change the address, so they can be safely used from any part of the code

Allocating memory

void*ptr=Memory.Alloc(6);// Allocates 6 bytes in memory// ...Memory.Free(ptr);// Free pointer

You can use other overloads of Alloc method for convenient work

int*ptr=Memory.Alloc<int>(6);// Allocates sizeof(int) * 6 bytes in memory

Allocating strings

stringmanagedString="Some unicode string";usingCoMemstrCo=newCoMem(managedString,CoStrType.Uni);ushort*unmanagedStringPtr=(ushort*)strCo;//...

Versions

Start ordinalFrameworkDescriptionDate
1.0.0.net9.0-Jun 26, 2025
0.0.0--Jan 1, 1970
2.0.1.net8.0Added MIT LicenseApr 28, 2024
2.0.0.net8.0Switched to DotnetNativeBaseApr 25, 2024
1.1.0.net8.0Changed frameworkNov 15, 2023
1.0.0.net7.0Sep 5, 2023

About

Memory utils for convenient work with memory, arrays and pointers

Topics

Resources

Stars

3 stars

Watchers

1 watching

Forks

Used by

Contributors

Languages