git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: "René Scharfe" <l.s.r@web.de>
Cc: Git Mailing List <git@vger.kernel.org>,
	Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH] daemon: use strbuf for hostname info
Date: Fri, 6 Mar 2015 20:07:02 -0500	[thread overview]
Message-ID: <20150307010702.GA8202@peff.net> (raw)
In-Reply-To: <54FA4C34.6080702@web.de>

On Sat, Mar 07, 2015 at 01:54:12AM +0100, René Scharfe wrote:

> >These probably want to all be strbuf_release(). Again, I doubt it
> >matters much because this is a forked daemon serving only a single
> >request (so they'll get freed by the OS soon anyway), but I think
> >freeing the memory here follows the original intent.
> 
> Using a static strbuf means (in my mind) "don't worry about freeing,
> a memory leak won't happen anyway because we reuse allocations".
> The new code adds recycling of allocations, which I somehow expect
> in connection with static allocations where possible.  You're right
> that using strbuf_release() would match the original code more
> strictly.

I don't mind recycling allocations like this. It's just that I think in
this case it makes the code actively more confusing, because we don't
actually expect any of these allocations to be recycled, do we? We
fork+exec for each daemon connection, which should receive exactly one
`host=` parameter.

That being said, I don't mind it too much if the recycling stays here.

> But this block is a no-op anyway because it's the first thing we do
> to these (initially empty) variables.  That's not immediately
> obvious and should be addressed in a separate patch.

Ah, yeah, just reading the diff I thought this was cleanup, not
initialization.

-Peff

  reply	other threads:[~2015-03-07  1:07 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-06  8:57 [PATCH] daemon: use strbuf for hostname info René Scharfe
2015-03-06 21:06 ` Jeff King
2015-03-07  0:20   ` René Scharfe
2015-03-07  1:08     ` Jeff King
2015-03-07 10:49       ` René Scharfe
2015-03-07  0:54   ` René Scharfe
2015-03-07  1:07     ` Jeff King [this message]
2015-03-07 10:50 ` [PATCH v2 1/2] " René Scharfe
2015-03-07 10:50 ` [PATCH v2 2/2] daemon: deglobalize hostname information René Scharfe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150307010702.GA8202@peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=l.s.r@web.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).