From c347011452ce4032dd4e800188c3c1412337e923 Mon Sep 17 00:00:00 2001 From: Mikhail <99481254+DCFApixels@users.noreply.github.com> Date: Wed, 18 Mar 2026 13:52:09 +0800 Subject: [PATCH] fix value pool --- src/Pools/EcsValuePool.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Pools/EcsValuePool.cs b/src/Pools/EcsValuePool.cs index 37c8be1..06a5838 100644 --- a/src/Pools/EcsValuePool.cs +++ b/src/Pools/EcsValuePool.cs @@ -126,7 +126,8 @@ namespace DCFApixels.DragonECS _sharedStore->_worldID = _worldID; _sharedStore->_componentTypeID = _componentTypeID; - _mapping = MemoryAllocator.Alloc(world.Capacity).Ptr; + _mapping = MemoryAllocator.AllocAndInit(world.Capacity).Ptr; + _mappingLength = world.Capacity; _sharedStore->_mapping = _mapping; var worldConfig = world.Configs.GetWorldConfigOrDefault(); if (_items == null) @@ -313,10 +314,12 @@ namespace DCFApixels.DragonECS #endregion #region Callbacks + private int _mappingLength; void IEcsPoolImplementation.OnWorldResize(int newSize) { - _mapping = MemoryAllocator.Realloc(_mapping, newSize).Ptr; + _mapping = MemoryAllocator.ReallocAndInit(_mapping, _mappingLength, newSize).Ptr; _sharedStore->_mapping = _mapping; + _mappingLength = newSize; } void IEcsPoolImplementation.OnReleaseDelEntityBuffer(ReadOnlySpan buffer) {