Fredrik Gustafsson <iv...@iveqy.com> writes:

> On Tue, Mar 11, 2014 at 06:58:11PM +0700, Duy Nguyen wrote:
>> On Tue, Mar 11, 2014 at 5:45 PM, Fredrik Gustafsson <iv...@iveqy.com> wrote:
>> > Strbuf needs to be released even if it's locally declared.
>> 
>> "path" is declared static. So yes it's a leak but the leak is minimum.
>> Your patch would make more sense if "static" is gone and it's leaked
>> after every write_archive_entry call.
>
> That's one of the reasons of the RFC. I know Junio thinks that minor
> things shouldn't be fixed by themselfes because it takes up review
> bandwidth, so it's better to fix them once you touch that part of the
> code anyway. (At least that's how I've understood him).

Yes, but I at the same time think this "static struct strbuf" is a
clear statement by the original author that this is not a leak
per-se.  The trade-off, if I am reading the code right, is between
keeping a piece of memory that is large enough to hold the longest
pathname until exit() vs saving repeated allocations and frees for
each of the thousands of paths in the resulting archive.

I tend to think the original strikes a better balance between the
two.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to