Refactor memory management and allocation strategies
Changed the `AllocationManager` initialization to specify size in `Program.cs` and commented out the disposal of `unfreeArray`. Changed `UnsafeArray` to use `AllocationManager.Realloc` for memory reallocation. Changed constructors of `UnsafeHashMap` and `UnsafeHashSet` to include an `AllocationOption` parameter for improved memory management. Added a `Remove` method to `UnsafeHashMap` for key-value pair removal. Changed `AllocationManager` to use a hash map instead of a queue for managing allocations. Added a `Realloc` method in `AllocationManager` for handling memory reallocation. Changed the `Free` method in `AllocationManager` to iterate through the hash map for freeing allocated memory.
This commit is contained in:
@@ -128,7 +128,7 @@ public unsafe struct HashMapHelper<TKey> : IDisposable
|
||||
return totalSize;
|
||||
}
|
||||
|
||||
public HashMapHelper(int capacity, int sizeOfTValue, uint minGrowth, Allocator allocator, AllocationOption allocationOption = AllocationOption.None)
|
||||
public HashMapHelper(int capacity, int sizeOfTValue, uint minGrowth, Allocator allocator, AllocationOption allocationOption)
|
||||
{
|
||||
if (capacity <= 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user