From 2e7c8a339f654ebd6fe178f4c81aa89c14851f22 Mon Sep 17 00:00:00 2001 From: ringabout <43030857+ringabout@users.noreply.github.com> Date: Mon, 28 Aug 2023 16:43:58 +0800 Subject: [PATCH] newStringOfCap now won't initialize all elements anymore (#22568) newStringOfCap nows won't initialize all elements anymore --- lib/system/strs_v2.nim | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/system/strs_v2.nim b/lib/system/strs_v2.nim index 296aae045f..1c15d14711 100644 --- a/lib/system/strs_v2.nim +++ b/lib/system/strs_v2.nim @@ -108,10 +108,11 @@ proc rawNewString(space: int): NimStringV2 {.compilerproc.} = result = NimStringV2(len: 0, p: nil) else: when compileOption("threads"): - var p = cast[ptr NimStrPayload](allocShared0(contentSize(space))) + var p = cast[ptr NimStrPayload](allocShared(contentSize(space))) else: - var p = cast[ptr NimStrPayload](alloc0(contentSize(space))) + var p = cast[ptr NimStrPayload](alloc(contentSize(space))) p.cap = space + p.data[0] = '\0' result = NimStringV2(len: 0, p: p) proc mnewString(len: int): NimStringV2 {.compilerproc.} =