From: Jacob Keller <jacob.e.keller@intel.com>
To: <git@vger.kernel.org>
Subject: memory leak when cloning a repository
Date: Thu, 5 Mar 2026 12:51:17 -0800 [thread overview]
Message-ID: <b9fa930e-7d5e-47f1-8896-1997cf7c0cdb@intel.com> (raw)
Hi,
I recently ran into a memory leak that appears consistently when I clone
a repository:
=================================================================
==581989==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 27168 byte(s) in 1 object(s) allocated from:
#0 0x7f0e100e6f2b in malloc (/lib64/libasan.so.8+0xe6f2b) (BuildId: 25975f766867e9e604dc5a71a8befeaed3301942)
#1 0x00000122ab77 in git_mmap ../compat/mmap.c:15
#2 0x000001169466 in xmmap_gently ../wrapper.c:884
#3 0x00000116959b in xmmap ../wrapper.c:907
#4 0x000000d168fd in check_packed_git_idx ../packfile.c:179
#5 0x000000d16cce in open_pack_index ../packfile.c:282
#6 0x000000d25273 in find_pack_entry_one ../packfile.c:2078
#7 0x00000099f969 in check_connected ../connected.c:148
#8 0x0000004dabdb in update_remote_refs ../builtin/clone.c:550
#9 0x0000004dabdb in cmd_clone ../builtin/clone.c:1602
#10 0x00000080a9b4 in run_builtin ../git.c:506
#11 0x00000080a9b4 in handle_builtin ../git.c:780
#12 0x000000810727 in run_argv ../git.c:863
#13 0x000000810727 in cmd_main ../git.c:985
#14 0x000000449e6f in main ../common-main.c:9
#15 0x7f0e0f6105b4 in __libc_start_call_main (/lib64/libc.so.6+0x35b4) (BuildId: ff0267465bc3d76e21003b3bc5598fd5ee63e261)
#16 0x7f0e0f610667 in __libc_start_main@@GLIBC_2.34 (/lib64/libc.so.6+0x3667) (BuildId: ff0267465bc3d76e21003b3bc5598fd5ee63e261)
#17 0x00000044c264 in _start (/home/jekeller/libexec/git-core/git+0x44c264) (BuildId: f75e04052d9435ea15ebf4480b490fe2eb150d92)
SUMMARY: AddressSanitizer: 27168 byte(s) leaked in 1 allocation(s).
I tried digging into why this leak occurs but so far I don't have a good idea.
This happens when running on next: 7842e34a6654 ("Sync with 'master'")
Thanks,
Jake
next reply other threads:[~2026-03-05 20:51 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-05 20:51 Jacob Keller [this message]
2026-03-05 22:02 ` memory leak when cloning a repository Jeff King
2026-03-05 23:03 ` [PATCH 0/4] plugging some mmap() leaks Jeff King
2026-03-05 23:08 ` [PATCH 1/4] check_connected(): delay opening new_pack Jeff King
2026-03-05 23:18 ` Jacob Keller
2026-03-05 23:09 ` [PATCH 2/4] check_connected(): fix leak of pack-index mmap Jeff King
2026-03-05 23:20 ` Jacob Keller
2026-03-05 23:12 ` [PATCH 3/4] pack-revindex: avoid double-loading .rev files Jeff King
2026-03-05 23:13 ` [PATCH 4/4] Makefile: turn on NO_MMAP when building with LSan Jeff King
2026-03-06 9:17 ` Jacob Keller
2026-03-06 16:25 ` [PATCH 5/4] meson: " Jeff King
2026-03-06 18:00 ` Ramsay Jones
2026-03-07 1:14 ` [PATCH 4/4] Makefile: " Junio C Hamano
2026-03-07 2:24 ` [PATCH 3.5/4] object-file: fix mmap() leak in odb_source_loose_read_object_stream() Jeff King
2026-03-07 5:35 ` Junio C Hamano
2026-03-10 12:23 ` Patrick Steinhardt
2026-03-06 4:37 ` [PATCH 0/4] plugging some mmap() leaks Ramsay Jones
2026-03-06 16:21 ` Jeff King
2026-03-06 17:49 ` Ramsay Jones
2026-03-06 18:37 ` Junio C Hamano
2026-03-06 18:55 ` Ramsay Jones
2026-03-06 22:05 ` Junio C Hamano
2026-03-06 23:25 ` Ramsay Jones
2026-03-07 1:15 ` Junio C Hamano
2026-03-05 23:16 ` memory leak when cloning a repository Jacob Keller
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=b9fa930e-7d5e-47f1-8896-1997cf7c0cdb@intel.com \
--to=jacob.e.keller@intel.com \
--cc=git@vger.kernel.org \
/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