feat(memory): transition to AllocationHandle API
Replaced the deprecated Allocator API with the new AllocationHandle API across the codebase. Updated constructors, methods, and tests to use AllocationHandle for memory management. Marked Allocator-based methods as [Obsolete] and provided alternatives. Added OwnershipTransferAnalyzer to detect ownership transfer issues and introduced OwnershipTransferAttribute for marking parameters. Enhanced DefensiveCopyAnalyzer with additional checks for readonly and ValueType instances. Refactored internal memory management in AllocationManager and updated benchmarks, utilities, and documentation to reflect the changes. BREAKING CHANGE: Deprecated Allocator API in favor of AllocationHandle. Updated constructors and methods to use AllocationHandle. Users must migrate to the new API.
This commit is contained in:
@@ -15,7 +15,7 @@ public class CollectionBenchmark
|
||||
[GlobalSetup]
|
||||
public void Setup()
|
||||
{
|
||||
_array = new UnsafeArray<Vector256<int>>(count, Allocator.Persistent);
|
||||
_array = new UnsafeArray<Vector256<int>>(count, AllocationHandle.Persistent);
|
||||
}
|
||||
|
||||
[GlobalCleanup]
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using BenchmarkDotNet.Attributes;
|
||||
using BenchmarkDotNet.Attributes;
|
||||
using Misaki.HighPerformance.LowLevel.Collections;
|
||||
|
||||
namespace Misaki.HighPerformance.Test.Benchmark;
|
||||
@@ -14,7 +14,7 @@ public class HashMapBenchmark
|
||||
[IterationSetup]
|
||||
public void Setup()
|
||||
{
|
||||
//_unsafeHashMap = new UnsafeHashMap<int, float>(count, Allocator.Persistent);
|
||||
//_unsafeHashMap = new UnsafeHashMap<int, float>(count, AllocationHandle.Persistent);
|
||||
_dictionary = new Dictionary<int, float>(count);
|
||||
|
||||
for (var i = 0; i < count; i++)
|
||||
|
||||
@@ -21,7 +21,7 @@ public class ParallelNoiseBenchmark
|
||||
public void Setup()
|
||||
{
|
||||
_jobScheduler = new JobScheduler(Environment.ProcessorCount);
|
||||
_buffers = new UnsafeArray<float>(_LENGTH, Allocator.Persistent);
|
||||
_buffers = new UnsafeArray<float>(_LENGTH, AllocationHandle.Persistent);
|
||||
}
|
||||
|
||||
[GlobalCleanup]
|
||||
|
||||
Reference in New Issue
Block a user