Re: [PATCH v2] server-info: do not list unlinked packs
- From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
- Date
- May 24, 2019, 07:34 UTC
- Message-ID
- <87sgt4fgqq.fsf@evledraar.gmail.com>
- In-Reply-To
- <20190523172723.eny6smdt57zxau6z@dcvr>
On Thu, May 23 2019, Eric Wong wrote:
Show 15 quoted lines
> Jeff King <peff@peff.net> wrote: >> On Thu, May 23, 2019 at 08:59:59AM +0000, Eric Wong wrote: >> >> > > We never delete entries from the in-memory packed_git list; a reprepare >> > > only adds to the list. You'd need to teach update_server_info() to >> > > ignore packs which are no longer present (or switch to exec-ing a >> > > separate update-server-info binary). >> > >> > Ah, checking files_exists() and setting a bit seems sufficient. >> >> Yes, though we do we even need to store the bit? > > I wanted to avoid the over-allocation, and I hit a bounds error > because I forgot to adjust num_pack as you mentioned > below. [...]ALLOC_GROW makes the whole thing much nicer.
If you want to avoid over-allocation the last thing you want is ALLOC_GROW() :)
I.e. see alloc_nr() in cache.h, we explicitly over-allocate with it.
But as our extensive use of it shows this sort of pattern is the right trade-off, both in terms of performance on modern hardware, and code readability in cases like this where we're never going to realistically have to worry about memory pressure.