Skip to content

Commit b3e3ae0

Browse files
committed
Fixed: Uninitialized chunk memory when building with GAIA_ECS_CHUNK_ALLOCATOR disabled
1 parent 1d65f73 commit b3e3ae0

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

include/gaia/ecs/chunk.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include "../config/config.h"
33

44
#include <cstdint>
5+
#include <cstring>
56
#include <tuple>
67
#include <type_traits>
78
#include <utility>
@@ -342,6 +343,7 @@ namespace gaia {
342343
GAIA_ASSERT(totalBytes <= MaxMemoryBlockSize);
343344
const auto allocSize = mem_block_size(sizeType);
344345
auto* pChunkMem = new uint8_t[allocSize];
346+
std::memset(pChunkMem, 0, allocSize);
345347
auto* pChunk = new (pChunkMem) Chunk(cc, chunkIndex, capacity, genEntities, sizeType, worldVersion);
346348
#endif
347349

single_include/gaia.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15081,6 +15081,7 @@ namespace gaia {
1508115081
} // namespace gaia
1508215082

1508315083
#include <cstdint>
15084+
#include <cstring>
1508415085
#include <tuple>
1508515086
#include <type_traits>
1508615087
#include <utility>
@@ -16890,6 +16891,7 @@ namespace gaia {
1689016891
GAIA_ASSERT(totalBytes <= MaxMemoryBlockSize);
1689116892
const auto allocSize = mem_block_size(sizeType);
1689216893
auto* pChunkMem = new uint8_t[allocSize];
16894+
memset(pChunkMem, 0, allocSize);
1689316895
auto* pChunk = new (pChunkMem) Chunk(cc, chunkIndex, capacity, genEntities, sizeType, worldVersion);
1689416896
#endif
1689516897

0 commit comments

Comments
 (0)