From 2edf46ff4a831cd95c25cdb3c78a70e12928e185 Mon Sep 17 00:00:00 2001 From: Mudit Ameta Date: Wed, 29 May 2024 18:31:41 +0200 Subject: [PATCH] [zdx_simple_arena] Update comment on why arena_calloc memset's to 0 in DEBUG mode --- zdx_simple_arena.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/zdx_simple_arena.h b/zdx_simple_arena.h index f4c325d..e35e45a 100644 --- a/zdx_simple_arena.h +++ b/zdx_simple_arena.h @@ -411,8 +411,9 @@ void *arena_calloc(arena_t *const ar, const size_t count, const size_t sz) /* * not zeroing memory before returning as unix, linux and macos return zero-filled memory on MAP_ANONYMOUS - * unless DEBUG is set as arena_create() memset's the whole arena to 0xcd in DEBUG mode - * and this function is guarded for those OS-es + * unless DEBUG is set as arena_create() memset's the whole arena to 0 in DEBUG mode as arena_create() + * in debug mode memset's the whole arena to SA_DEBUG_BYTE which is 0xcd by default. If we don't memset to 0 + * functions that rely on arena_calloc zero-ing memory, will fail in DEBUG mode. */ #if defined(DEBUG) memset(ptr, 0, total_size);