From 964fad174d57ce8280afe92a652140ebb846141e Mon Sep 17 00:00:00 2001 From: Dmitry Volyntsev Date: Tue, 8 Sep 2026 15:46:52 -0700 Subject: [PATCH] Memory pool: junk filling only in debug builds Previously, every freed chunk was overwritten with 0x5A in all builds, adding a memset to each njs_mp_free() call. The fix is to keep the junk filling under NJS_DEBUG. Release builds no longer poison freed chunks; nothing ever inspected the pattern. --- src/njs_mp.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/njs_mp.c b/src/njs_mp.c index f1d464a3..83fb76db 100644 --- a/src/njs_mp.c +++ b/src/njs_mp.c @@ -120,9 +120,15 @@ struct njs_mp_s { map[chunk / 8] &= ~(0x80 >> (chunk & 7)) +#if (NJS_DEBUG) #define njs_mp_free_junk(p, size) \ njs_memset((p), 0x5A, size) +#else +#define njs_mp_free_junk(p, size) + +#endif + #define njs_is_power_of_two(value) \ ((((value) - 1) & (value)) == 0) -- 2.47.3