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 TestUnsafeChunkedQueue
|
||||
[TestMethod]
|
||||
public void BasicEnqueueDequeueTest()
|
||||
{
|
||||
using var queue = new UnsafeChunkedQueue<int>(32, Allocator.Persistent);
|
||||
using var queue = new UnsafeChunkedQueue<int>(32, AllocationHandle.Persistent);
|
||||
|
||||
Assert.IsTrue(queue.IsCreated);
|
||||
|
||||
@@ -35,7 +35,7 @@ public class TestUnsafeChunkedQueue
|
||||
public void ChunkExpansionTest()
|
||||
{
|
||||
// Force chunk expansions by enqueuing more than the chunk capacity
|
||||
using var queue = new UnsafeChunkedQueue<int>(16, Allocator.Persistent);
|
||||
using var queue = new UnsafeChunkedQueue<int>(16, AllocationHandle.Persistent);
|
||||
|
||||
var totalItems = 100;
|
||||
|
||||
@@ -57,7 +57,7 @@ public class TestUnsafeChunkedQueue
|
||||
public void ConcurrentEnqueueDequeueTest()
|
||||
{
|
||||
// Multi-threaded stress test to verify lock-free safety and chunk caching
|
||||
using var queue = new UnsafeChunkedQueue<int>(64, Allocator.Persistent);
|
||||
using var queue = new UnsafeChunkedQueue<int>(64, AllocationHandle.Persistent);
|
||||
var totalElements = 100_000;
|
||||
|
||||
var enqueueTask = Task.Run(() =>
|
||||
|
||||
Reference in New Issue
Block a user