From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS53758 23.128.96.0/24 X-Spam-Status: No, score=-3.9 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by dcvr.yhbt.net (Postfix) with ESMTP id 1652A1F9FE for ; Wed, 21 Jul 2021 11:09:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238108AbhGUJXJ (ORCPT ); Wed, 21 Jul 2021 05:23:09 -0400 Received: from cloud.peff.net ([104.130.231.41]:52944 "EHLO cloud.peff.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238404AbhGUJOS (ORCPT ); Wed, 21 Jul 2021 05:14:18 -0400 Received: (qmail 1790 invoked by uid 109); 21 Jul 2021 09:54:32 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Wed, 21 Jul 2021 09:54:32 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 2732 invoked by uid 111); 21 Jul 2021 09:54:52 -0000 Received: from coredump.intra.peff.net (HELO sigill.intra.peff.net) (10.0.0.2) by peff.net (qpsmtpd/0.94) with (TLS_AES_256_GCM_SHA384 encrypted) ESMTPS; Wed, 21 Jul 2021 05:54:52 -0400 Authentication-Results: peff.net; auth=none Date: Wed, 21 Jul 2021 05:54:50 -0400 From: Jeff King To: Taylor Blau Cc: git@vger.kernel.org, dstolee@microsoft.com, gitster@pobox.com, jonathantanmy@google.com Subject: Re: [PATCH v2 03/24] pack-bitmap-write.c: free existing bitmaps Message-ID: References: <490d733d121e206ccdc335812c03f31c380bcd86.1624314293.git.me@ttaylorr.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <490d733d121e206ccdc335812c03f31c380bcd86.1624314293.git.me@ttaylorr.com> Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org On Mon, Jun 21, 2021 at 06:25:04PM -0400, Taylor Blau wrote: > When writing a new bitmap, the bitmap writer code attempts to read the > existing bitmap (if one is present). This is done in order to quickly > permute the bits of any bitmaps for commits which appear in the existing > bitmap, and were also selected for the new bitmap. > > But since this code was added in 341fa34887 (pack-bitmap-write: use > existing bitmaps, 2020-12-08), the resources associated with opening an > existing bitmap were never released. > > It's fine to ignore this, but it's bad hygiene. It will also cause a > problem for the multi-pack-index builtin, which will be responsible not > only for writing bitmaps, but also for expiring any old multi-pack > bitmaps. > > If an existing bitmap was reused here, it will also be expired. That > will cause a problem on platforms which require file resources to be > closed before unlinking them, like Windows. Avoid this by ensuring we > close reused bitmaps with free_bitmap_index() before removing them. I agree with all of that. But just "it's a memory leak" would have contented me, too. :) -Peff