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:
@@ -58,10 +58,10 @@ public unsafe struct UnsafeQueue<T> : IUnsafeCollection<T>
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invalid constructor. Use <see cref="UnsafeQueue(int, Allocator, AllocationOption)"/> or <see cref="UnsafeQueue(int, AllocationHandle, AllocationOption)"/> instead."/>
|
||||
/// Initializes a new instance of UnsafeQueue with a default size of 1 and a persistent allocation handle.
|
||||
/// </summary>
|
||||
public UnsafeQueue()
|
||||
: this(0, Allocator.Invalid)
|
||||
: this(1, AllocationHandle.Persistent)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -72,6 +72,7 @@ public unsafe struct UnsafeQueue<T> : IUnsafeCollection<T>
|
||||
_offset = 0;
|
||||
}
|
||||
|
||||
[Obsolete("Use AllocationHandle instead.")]
|
||||
public UnsafeQueue(int capacity, Allocator allocator, AllocationOption allocationType = AllocationOption.None)
|
||||
: this(capacity, AllocationManager.GetAllocationHandle(allocator), allocationType)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user