Fixed compilation issue when using mimalloc
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||
<Authors>Misaki</Authors>
|
||||
<AssemblyVersion>1.6.19</AssemblyVersion>
|
||||
<AssemblyVersion>1.6.20</AssemblyVersion>
|
||||
<Version>$(AssemblyVersion)</Version>
|
||||
<PackageProjectUrl>https://git.personalnas.com/Misaki/Misaki.HighPerformance.git</PackageProjectUrl>
|
||||
<RepositoryUrl>https://git.personalnas.com/Misaki/Misaki.HighPerformance.git</RepositoryUrl>
|
||||
|
||||
@@ -143,13 +143,13 @@ public static unsafe partial class MemoryUtility
|
||||
public static void* Realloc(void* ptr, nuint size)
|
||||
{
|
||||
#if MHP_ENABLE_MIMALLOC
|
||||
var ptr = Mimalloc.mi_realloc(ptr, size);
|
||||
if (ptr == null)
|
||||
var newPtr = Mimalloc.mi_realloc(ptr, size);
|
||||
if (newPtr == null)
|
||||
{
|
||||
throw new OutOfMemoryException("Failed to reallocate memory using Realloc.");
|
||||
}
|
||||
|
||||
return ptr;
|
||||
return newPtr;
|
||||
#elif NET6_0_OR_GREATER
|
||||
return NativeMemory.Realloc(ptr, size);
|
||||
#else
|
||||
@@ -169,13 +169,13 @@ public static unsafe partial class MemoryUtility
|
||||
public static void* AlignedRealloc(void* ptr, nuint size, nuint alignment)
|
||||
{
|
||||
#if MHP_ENABLE_MIMALLOC
|
||||
var ptr = Mimalloc.mi_realloc_aligned(ptr, size, alignment);
|
||||
if (ptr == null)
|
||||
var newPtr = Mimalloc.mi_realloc_aligned(ptr, size, alignment);
|
||||
if (newPtr == null)
|
||||
{
|
||||
throw new OutOfMemoryException("Failed to reallocate aligned memory using AlignedRealloc.");
|
||||
}
|
||||
|
||||
return ptr;
|
||||
return newPtr;
|
||||
#elif NET6_0_OR_GREATER
|
||||
return NativeMemory.AlignedRealloc(ptr, size, alignment);
|
||||
#else
|
||||
|
||||
Reference in New Issue
Block a user