From patchwork Wed Oct 3 17:12:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Jean-No=C3=ABl_Avila_via_GitGitGadget?= X-Patchwork-Id: 10625113 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BEB8C17E0 for ; Wed, 3 Oct 2018 17:12:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A295528F1C for ; Wed, 3 Oct 2018 17:12:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 96EC028F28; Wed, 3 Oct 2018 17:12:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3935028F1C for ; Wed, 3 Oct 2018 17:12:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727151AbeJDABe (ORCPT ); Wed, 3 Oct 2018 20:01:34 -0400 Received: from mail-pl1-f193.google.com ([209.85.214.193]:39469 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726851AbeJDABd (ORCPT ); Wed, 3 Oct 2018 20:01:33 -0400 Received: by mail-pl1-f193.google.com with SMTP id w14-v6so3781762plp.6 for ; Wed, 03 Oct 2018 10:12:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:message-id:in-reply-to:references:from:subject:mime-version :content-transfer-encoding:fcc:content-transfer-encoding :mime-version:to:cc; bh=pFzp3t3ScLKQyR0iJgAovX+Jm5j9rNvFghhamcCOXDw=; b=TzNIcxFDSMZBMYBShqoRLHj2O5J5++vJA/EjRGjfgsuyl57IkYu4L0fATmUhY4SdIh rVVIS94UInQNV2hMU/hA/gWXqivYyOxyzHi75wBZIMfteWpGXbjfMx0pAEEtSkGSB288 iYnyI/i9GGfMvth/78lBvyjy29BR8Mn7jIEywkSTHaKw+hvQy1wDcW3aQIBtJOa30+Rp t/IHuS5ihcfIO+iToviZg07KyX1J1RSdm7YGvgLFAmJ3AYx/2SXZ3IOeFFqiekELQyqN vSQgqcaEtcMOgp77vmJDHkvqkPXqsrsx5KH+ENFAV1QVsdYZaRalgq0XlDfH/cpI3PVM n5yw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:in-reply-to:references:from :subject:mime-version:content-transfer-encoding:fcc :content-transfer-encoding:mime-version:to:cc; bh=pFzp3t3ScLKQyR0iJgAovX+Jm5j9rNvFghhamcCOXDw=; b=GARxMUfX0J3sdle2R3kXcQ2ckUObD1FcRxuIYkFKZdjZyNKhLdwxoao+POOMrrBvzK 0fOJ8CdvNnHATf+c/F7mK3V8uhhfSoc9VbiaaYAO83TuQ381lsbcvjha58Lf/DE58aBY Qgyk1hMYKyxn+pnhSsoAT+ZnSH/MbEXuziTwrQTx2tloDmCpsMN3xQlpX2aBUcE6CMm0 3Pqu1I3FhZcz5QmAQxACZUjAVBJEI42ZS5T5dz0LiGyQgL92nUjUNSikqHjMBGDk5Jtu ByXdt6pKaJXO1111dKJhzm0hbcF8ffaFsXIlqTaP46e6AlSqAcPWZs+GgkO1LSlM1klW TUeA== X-Gm-Message-State: ABuFfoiYAIWeMMFR/riKxNuDtmStpFMgC4tVCp0wziu8BzM415cRM6vE /u+P5TLLIzUov/I9PvzPytpO7oNx X-Google-Smtp-Source: ACcGV63cRAStcq5vOQMASmyt50mMxT7v/KZlcKIXUqNHUI3Fa6L6jRqUCF0vK73SDPH5r5RuU0seyA== X-Received: by 2002:a17:902:7e0f:: with SMTP id b15-v6mr2593552plm.246.1538586736709; Wed, 03 Oct 2018 10:12:16 -0700 (PDT) Received: from [127.0.0.1] ([40.112.137.127]) by smtp.gmail.com with ESMTPSA id y185-v6sm2669240pgd.8.2018.10.03.10.12.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 03 Oct 2018 10:12:15 -0700 (PDT) Date: Wed, 03 Oct 2018 10:12:15 -0700 (PDT) X-Google-Original-Date: Wed, 03 Oct 2018 17:12:10 GMT Message-Id: In-Reply-To: References: From: "Derrick Stolee via GitGitGadget" Subject: [PATCH v2 1/3] commit-graph: clean up leaked memory during write MIME-Version: 1.0 Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Junio C Hamano , Derrick Stolee Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Derrick Stolee The write_commit_graph() method in commit-graph.c leaks some lits and strings during execution. In addition, a list of strings is leaked in write_commit_graph_reachable(). Clean these up so our memory checking is cleaner. Further, if we use a list of pack-files to find the commits, we can leak the packed_git structs after scanning them for commits. Running the following commands demonstrates the leak before and the fix after: * valgrind --leak-check=full ./git commit-graph write --reachable * valgrind --leak-check=full ./git commit-graph write --stdin-packs Signed-off-by: Martin Ågren Signed-off-by: Derrick Stolee --- commit-graph.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/commit-graph.c b/commit-graph.c index 2a24eb8b5a..ceca6026b0 100644 --- a/commit-graph.c +++ b/commit-graph.c @@ -693,11 +693,12 @@ static int add_ref_to_list(const char *refname, void write_commit_graph_reachable(const char *obj_dir, int append, int report_progress) { - struct string_list list; + struct string_list list = STRING_LIST_INIT_DUP; - string_list_init(&list, 1); for_each_ref(add_ref_to_list, &list); write_commit_graph(obj_dir, NULL, &list, append, report_progress); + + string_list_clear(&list, 0); } void write_commit_graph(const char *obj_dir, @@ -764,6 +765,7 @@ void write_commit_graph(const char *obj_dir, die(_("error opening index for %s"), packname.buf); for_each_object_in_pack(p, add_packed_commits, &oids, 0); close_pack(p); + free(p); } stop_progress(&oids.progress); strbuf_release(&packname); @@ -846,9 +848,11 @@ void write_commit_graph(const char *obj_dir, compute_generation_numbers(&commits, report_progress); graph_name = get_commit_graph_filename(obj_dir); - if (safe_create_leading_directories(graph_name)) + if (safe_create_leading_directories(graph_name)) { + UNLEAK(graph_name); die_errno(_("unable to create leading directories of %s"), graph_name); + } hold_lock_file_for_update(&lk, graph_name, LOCK_DIE_ON_ERROR); f = hashfd(lk.tempfile->fd, lk.tempfile->filename.buf); @@ -893,9 +897,9 @@ void write_commit_graph(const char *obj_dir, finalize_hashfile(f, NULL, CSUM_HASH_IN_STREAM | CSUM_FSYNC); commit_lock_file(&lk); + free(graph_name); + free(commits.list); free(oids.list); - oids.alloc = 0; - oids.nr = 0; } #define VERIFY_COMMIT_GRAPH_ERROR_HASH 2 From patchwork Wed Oct 3 17:12:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Jean-No=C3=ABl_Avila_via_GitGitGadget?= X-Patchwork-Id: 10625115 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CF46C15E8 for ; Wed, 3 Oct 2018 17:12:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B301028F1C for ; Wed, 3 Oct 2018 17:12:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A7B9628F28; Wed, 3 Oct 2018 17:12:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4DC8728F1C for ; Wed, 3 Oct 2018 17:12:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727197AbeJDABg (ORCPT ); Wed, 3 Oct 2018 20:01:36 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:42744 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726851AbeJDABf (ORCPT ); Wed, 3 Oct 2018 20:01:35 -0400 Received: by mail-pf1-f196.google.com with SMTP id f26-v6so1839032pfn.9 for ; Wed, 03 Oct 2018 10:12:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:message-id:in-reply-to:references:from:subject:mime-version :content-transfer-encoding:fcc:content-transfer-encoding :mime-version:to:cc; bh=WVnK0rhBNYFPstiMUpc7/jclqVtaqXJ6+ZH/tv+tlBc=; b=lwCktzkfKi2st5rcOkimtmDqmtANbCYzZ5bWg+lBKjhLOl8JCA4EHSgtNod4kMF8d1 2eNzyKaa44Q60iZy/qHi6Z9XTUTta+LF0loIW9w5RHHA1C6yp26hHQUmGNE/iQau7N72 Mfboek5N6CJ/OoAEKJ1Ulb9LnzAZoERav/C/Dcy2u6/LPTZdSW3jX7OlWdqKbrG+ZPHG rXAp4yA030bDTP4Wo11K2WxyKjm/I2UG/+oKjq7GGyKBdh2M/OjshQFsbmaTLwf8G7Hd r04Ewk4ADLaEObG4JVskYAWY6m7yuWdjsTNe2kslauuOn21HdaTWNzc8G6n1MkFPaiBh hSaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:in-reply-to:references:from :subject:mime-version:content-transfer-encoding:fcc :content-transfer-encoding:mime-version:to:cc; bh=WVnK0rhBNYFPstiMUpc7/jclqVtaqXJ6+ZH/tv+tlBc=; b=UI+W59Tnl8qAv005A9Zx0Q3a6DP6OJP2Mz2rRnabS7S6CQ03EcZ0cL8004w3WGJY2P ecyG+sIOfT52xRKB/UPDllqo7XtUC2Kcl9DZsowB5cLVcWN875BvTsbUdyh7Q/ZwVKzw x3ZLVI97XDzEYPfN7ec5WJTlnD6J4StuvhDYQKXr/crTEz92+c1iqLTMRMG5hN1xGbYW F5UKW+xuaJEqyzhol7n2fsd3Ise1+hEJiVpHbom2xpMDL5r04SdGt4PYkT/3W7bvjdJA pXEpGIJdwlvdaXs06T38i6p6+/5+ZN1AFmsKev9+xit6+b4IlxRXfr+Ib8al34wqfSQS OLcw== X-Gm-Message-State: ABuFfohgCRHW6wGRFS74s4LTTfQm55MQ3GdlVLf4FsjA005vcClMr7Y6 d/QT0obtjqysekJLf4ScxOoYbvA4 X-Google-Smtp-Source: ACcGV60Z0wx/5qv9/Ku6lyclhHCFui5KinYKipzOJWSceeWPNxMi1EF15EV1IV9l0cA2wxEmSmXJ+Q== X-Received: by 2002:a65:6143:: with SMTP id o3-v6mr2254207pgv.52.1538586738332; Wed, 03 Oct 2018 10:12:18 -0700 (PDT) Received: from [127.0.0.1] ([40.112.137.127]) by smtp.gmail.com with ESMTPSA id p24-v6sm2012836pgm.70.2018.10.03.10.12.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 03 Oct 2018 10:12:17 -0700 (PDT) Date: Wed, 03 Oct 2018 10:12:17 -0700 (PDT) X-Google-Original-Date: Wed, 03 Oct 2018 17:12:11 GMT Message-Id: <13032d847533cfecbd9a912312cab4f256e46b30.1538586732.git.gitgitgadget@gmail.com> In-Reply-To: References: From: " =?utf-8?q?Martin_=C3=85gren?= via GitGitGadget" Subject: [PATCH v2 2/3] builtin/commit-graph.c: UNLEAK variables MIME-Version: 1.0 Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Junio C Hamano , =?utf-8?q?Martin_=C3=85gren?= Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: =?UTF-8?q?Martin=20=C3=85gren?= `graph_verify()`, `graph_read()` and `graph_write()` do the hard work of `cmd_commit_graph()`. As soon as these return, so does `cmd_commit_graph()`. `strbuf_getline()` may allocate memory in the strbuf, yet return EOF. We need to release the strbuf or UNLEAK it. Go for the latter since we are close to returning from `graph_write()`. `graph_write()` also fails to free the strings in the string list. They have been added to the list with `strdup_strings` set to 0. We could flip `strdup_strings` before clearing the list, which is our usual hack in situations like this. But since we are about to exit, let's just UNLEAK the whole string list instead. UNLEAK `graph` in `graph_verify`. While at it, and for consistency, UNLEAK in `graph_read()` as well, and remove an unnecessary UNLEAK just before dying. Signed-off-by: Martin Ågren Signed-off-by: Derrick Stolee --- builtin/commit-graph.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/builtin/commit-graph.c b/builtin/commit-graph.c index bc0fa9ba52..66f12eb009 100644 --- a/builtin/commit-graph.c +++ b/builtin/commit-graph.c @@ -64,6 +64,7 @@ static int graph_verify(int argc, const char **argv) if (!graph) return 0; + UNLEAK(graph); return verify_commit_graph(the_repository, graph); } @@ -89,10 +90,8 @@ static int graph_read(int argc, const char **argv) graph_name = get_commit_graph_filename(opts.obj_dir); graph = load_commit_graph_one(graph_name); - if (!graph) { - UNLEAK(graph_name); + if (!graph) die("graph file %s does not exist", graph_name); - } FREE_AND_NULL(graph_name); @@ -115,7 +114,7 @@ static int graph_read(int argc, const char **argv) printf(" large_edges"); printf("\n"); - free_commit_graph(graph); + UNLEAK(graph); return 0; } @@ -166,6 +165,8 @@ static int graph_write(int argc, const char **argv) pack_indexes = &lines; if (opts.stdin_commits) commit_hex = &lines; + + UNLEAK(buf); } write_commit_graph(opts.obj_dir, @@ -174,7 +175,7 @@ static int graph_write(int argc, const char **argv) opts.append, 1); - string_list_clear(&lines, 0); + UNLEAK(lines); return 0; } From patchwork Wed Oct 3 17:12:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Jean-No=C3=ABl_Avila_via_GitGitGadget?= X-Patchwork-Id: 10625117 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 780E217E0 for ; Wed, 3 Oct 2018 17:12:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5C8ED28F1C for ; Wed, 3 Oct 2018 17:12:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5154728F28; Wed, 3 Oct 2018 17:12:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EA64528F1C for ; Wed, 3 Oct 2018 17:12:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727234AbeJDABh (ORCPT ); Wed, 3 Oct 2018 20:01:37 -0400 Received: from mail-pl1-f194.google.com ([209.85.214.194]:34148 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726851AbeJDABg (ORCPT ); Wed, 3 Oct 2018 20:01:36 -0400 Received: by mail-pl1-f194.google.com with SMTP id f18-v6so3778412plr.1 for ; Wed, 03 Oct 2018 10:12:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:message-id:in-reply-to:references:from:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=VuotZzHgDMRiVrQhM09A8eBcul7JL+o4OMz5phJz6yc=; b=AHP9e16/dT7bCgIGciuk7kWowsGCTSfnZsRlOU0r+fL6tcGHLeJ1SScKmCGSFlZV2P dJRsM4KuLieJwq3IDfnnLenHTXnyPyPgjk+WEs3u2t858VgZVrcrYG8ICKgjkX11WLuj wConWT2itKSvn9qgVC3eBy/aS3kbxLNRu7CorOiUrjD3MD4zNYokrR6Qy7Fw9CR7dYVI sAIsTa4af5gLsgfZineR3xcorJ3KX609ALd9mqbZ1FPKVlba9j8U+Y4RGZgzZwTjjiSH 8r0cGGKPF/Zx4az1YtWlbDz/eBiCvq0MaHbBVd+809qTrvTX71HjVv6tN4KKRIKu3V7F 2yYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:in-reply-to:references:from :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=VuotZzHgDMRiVrQhM09A8eBcul7JL+o4OMz5phJz6yc=; b=CTylfgA6j2AaTrMyon4INDz4B4H3yBo3bHGvuaj0ILbDNWDxvwqDVdlsVWEAdtyln2 OkTR3wm3QmhJHtsyPZKfKmIiwCzX5A7I+R/RQaEGEsZBFQZky9RSph9E5mH/ukJ5LLAW ISvFwWwnkfX3DnHOyXybsN3ZKikDrqbDXe6mjjuP9V6WEag4m0EC40Ld27J/FgJRQer+ DkwMP2MdkntOeNt4V4pFDLStYx9R37oZqTqyZ18HEE/KOs9zuSBWrWsan7Opy02HBp+6 3tDL3QTKhysI+vOqwqeY+pmFarPPIFbpGMVdPBkbBah7+RYYcAoqZvmK/z36xY8MzS/6 5Xvg== X-Gm-Message-State: ABuFfoh4v/+SaSSjIb+vDJVK43grzNUbB5KGiB2HoDFvv0jTRgao9fEV 0Lz8ERUxGj4d/8z3Y6RJajvryO3G X-Google-Smtp-Source: ACcGV60MnCHe6eH35Swu40YPxTpz91yPq7g2MifRahqulowuNr+3HhWcNrqYSVs4v1coptpuuxmehQ== X-Received: by 2002:a17:902:447:: with SMTP id 65-v6mr2556605ple.325.1538586740047; Wed, 03 Oct 2018 10:12:20 -0700 (PDT) Received: from [127.0.0.1] ([40.112.137.127]) by smtp.gmail.com with ESMTPSA id g17-v6sm3437090pfe.37.2018.10.03.10.12.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 03 Oct 2018 10:12:19 -0700 (PDT) Date: Wed, 03 Oct 2018 10:12:19 -0700 (PDT) X-Google-Original-Date: Wed, 03 Oct 2018 17:12:12 GMT Message-Id: <1002fd34fc57e929265d07ad6e6010116b27b7a9.1538586732.git.gitgitgadget@gmail.com> In-Reply-To: References: From: "Derrick Stolee via GitGitGadget" Subject: [PATCH v2 3/3] commit-graph: reduce initial oid allocation Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Junio C Hamano , Derrick Stolee Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Derrick Stolee While writing a commit-graph file, we store the full list of commits in a flat list. We use this list for sorting and ensuring we are closed under reachability. The initial allocation assumed that (at most) one in four objects is a commit. This is a dramatic over-count for many repos, especially large ones. Since we grow the repo dynamically, reduce this count by a factor of eight. We still set it to a minimum of 1024 before allocating. Signed-off-by: Derrick Stolee --- commit-graph.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commit-graph.c b/commit-graph.c index ceca6026b0..e773703e1d 100644 --- a/commit-graph.c +++ b/commit-graph.c @@ -720,7 +720,7 @@ void write_commit_graph(const char *obj_dir, struct progress *progress = NULL; oids.nr = 0; - oids.alloc = approximate_object_count() / 4; + oids.alloc = approximate_object_count() / 32; oids.progress = NULL; oids.progress_done = 0;