git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] daemon: use strbuf for hostname info

From
Jeff King <peff@peff.net>
Date
Mar 7, 2015, 01:07 UTC
Message-ID
<20150307010702.GA8202@peff.net>
In-Reply-To
<54FA4C34.6080702@web.de>
On Sat, Mar 07, 2015 at 01:54:12AM +0100, René Scharfe wrote:
Show 11 quoted lines
> >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
Previous: René ScharfeNext: René Scharfe
Message 7 of 9 in “daemon: use strbuf for hostname info”
  1. daemon: use strbuf for hostname infoRené Scharfe, Mar 6, 2015
  2. Jeff KingMar 6, 2015
  3. René ScharfeMar 7, 2015
  4. Jeff KingMar 7, 2015
  5. René ScharfeMar 7, 2015
  6. René ScharfeMar 7, 2015
  7. Jeff KingMar 7, 2015
  8. 1/2 daemon: use strbuf for hostname infoRené Scharfe, Mar 7, 2015
  9. 2/2 daemon: deglobalize hostname informationRené Scharfe, Mar 7, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.