diff --git a/src/Consts.cs b/src/Consts.cs index 4377352..15bff6c 100644 --- a/src/Consts.cs +++ b/src/Consts.cs @@ -89,7 +89,12 @@ namespace DCFApixels.DragonECS #else false; #endif - + public const bool ENABLE_DUMMY_SPAN = +#if ENABLE_DUMMY_SPAN + true; +#else + false; +#endif [Obsolete("DRAGONECS_ENABLE_DEBUG_SERVICE")] diff --git a/src/Internal/Allocators/AllocatorUtility.cs b/src/Internal/Allocators/AllocatorUtility.cs index 7f6a46a..27f608b 100644 --- a/src/Internal/Allocators/AllocatorUtility.cs +++ b/src/Internal/Allocators/AllocatorUtility.cs @@ -10,8 +10,16 @@ namespace DCFApixels.DragonECS.Core.Internal } public static unsafe void ClearAllocatedMemory(byte* ptr, int startByte, int lengthInBytes) { +#if ENABLE_DUMMY_SPAN + lengthInBytes += startByte; + for (int i = startByte; i < lengthInBytes; i++) + { + ptr[i] = 0; + } +#else Span memorySpan = new Span(ptr + startByte, lengthInBytes); memorySpan.Clear(); +#endif } } }