From: Junio C Hamano Date: Sat, 18 Dec 2021 00:09:29 GMT Subject: Re: [PATCH v6 1/6] object-file.c: release strbuf in write_loose_object() Message-ID: In-Reply-To: René Scharfe writes: > There was no leak before. Both strbufs are static and both functions > they are passed to (loose_object_path() and create_tmpfile()) reset > them first. So while the allocated memory was not released before, > it was reused. > > Not sure if making write_loose_object() allocate and release these > buffers on every call has much of a performance impact. The only > reason I can think of for wanting such a change is to get rid of the > static buffers, to allow the function to be used by concurrent > threads. > > So I think either keeping the code as-is or also making the strbufs > non-static would be better (but then discussing a possible > performance impact in the commit message would be nice). Makes sense.