Skip to content

Commit 3619a98

Browse files
committed
Version 1.1.0: .NET 8 and IUnsafeDisposable interface.
1 parent 37979b2 commit 3619a98

File tree

4 files changed

+45
-6
lines changed

4 files changed

+45
-6
lines changed

README.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,15 @@ Provides faster alternatives to `Memory<T>` and `ReadOnlyMemory<T>` in addition
99

1010
Allows to manipulate array of unmanaged pointers with the `UnmanagedArrayPointer<T>` struct.
1111

12+
## Making a release
13+
14+
* Generate new commit with your changes with a message: `git commit -m "Version X.X.X: Notes about the change"`
15+
* Tag the new commit: `git tag vX.X.X -m "Version X.X.X"`
16+
* Push the commit: `git push` and the tag `git push origin vX.X.X`
17+
* Build the new `Release` binaries. The package is built automatically alongside the binaries.
18+
* Navigate to `./UnmanagedMemoryUtils/UnmanagedMemoryUtils/bin/Release`
19+
* Publish the package: `dotnet nuget push .\UnmanagedMemoryUtils.X.X.X.nupkg --api-key <YOUR_API_KEY> --source https://api.nuget.org/v3/index.json`
20+
1221
## Changelog
1322

1423
### Version 1.0.2
@@ -31,4 +40,10 @@ Allows to manipulate array of unmanaged pointers with the `UnmanagedArrayPointer
3140

3241
### Version 1.0.6
3342

34-
* Readme update with Nuget link.
43+
* Readme update with Nuget link.
44+
45+
### Version 1.1.0
46+
47+
* Update to .NET 8
48+
* Adds a new `IUnsafeDisposable` interface which offers an unsafe but less performance impacting to the standard `IDisposable` and finalizer pattern.
49+
* This interface is now implemented by `IUnmanagedString` and is available to use outside the library.

UnmanagedMemoryUtils/UnmanagedMemoryUtils/IUnmanagedString.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/// <summary>
44
/// Represents an unmanaged string most basic form.
55
/// </summary>
6-
public interface IUnmanagedString
6+
public interface IUnmanagedString : IUnsafeDisposable
77
{
88
nint Pointer { get; }
99
string ToString();
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
namespace UnmanagedMemoryUtils;
2+
3+
/// <summary>
4+
/// Represents an object that contains native resources which should be freed, using the <see cref="Free"/> method.
5+
/// </summary>
6+
/// <remarks>
7+
/// This interface differs of the .NET <see cref="IDisposable"/> implementation in that it is not expected
8+
/// to be used alongside a finalizer to avoid the performance penalty, it is your responsibility to call <see cref="Free"/>
9+
/// and you will face memory leaks if you don't do so consistently. So it is a tradeoff of adding more responsibility on the developer in favor of performance.
10+
/// </remarks>
11+
public interface IUnsafeDisposable
12+
{
13+
/// <summary>
14+
/// Free the native resources used as part of this object.
15+
/// It is not neceessary to free managed resources altough it can also be done if so wished.
16+
/// </summary>
17+
void Free();
18+
}

UnmanagedMemoryUtils/UnmanagedMemoryUtils/UnmanagedMemoryUtils.csproj

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net7.0</TargetFramework>
4+
<TargetFramework>net8.0</TargetFramework>
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
77
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
88
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
99
<Title>UnmanagedMemoryUtils</Title>
10-
<VersionPrefix>1.0.6</VersionPrefix>
10+
<VersionPrefix>1.1.0</VersionPrefix>
1111
<PackageReadmeFile>README.md</PackageReadmeFile>
1212
<Description>A .NET collection of utilities for working with unmanaged memory.
1313
Provides faster alternatives to Memory&lt;T&gt; and ReadOnlyMemory&lt;T&gt; in addition to accessing unmanaged string from managed code.
@@ -38,8 +38,14 @@ Version 1.0.5
3838

3939
Version 1.0.6
4040

41-
* Readme update with Nuget link.</PackageReleaseNotes>
42-
</PropertyGroup>
41+
* Readme update with Nuget link.
42+
43+
### Version 1.1.0
44+
45+
* Update to .NET 8
46+
* Adds a new IUnsafeDisposable interface which offers an unsafe but less performance impacting to the standard IDisposable and finalizer pattern.
47+
* This interface is now implemented by IUnmanagedString and is available to use outside the library.</PackageReleaseNotes>
48+
</PropertyGroup>
4349
<ItemGroup>
4450
<None Include="..\..\README.md" Pack="true" PackagePath="\" />
4551
</ItemGroup>

0 commit comments

Comments
 (0)