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

Huge possible memory leak while cherry-picking.

From
Лежанкин Иван <abyss.7@gmail.com>
Date
Aug 9, 2013, 12:13 UTC
Message-ID
<CAJc7LbpRuqug9pLFVVg=XMvJ9u_P0ZVSy2MVBDaCVkjvfKnfJw@mail.gmail.com>
Hi,

I have tried to cherry-pick a range of ~200 commits from one branch to another. And you can't imagine how I was surprised when the git process ate 8 Gb of RAM and died - before cherry-picking was complete.

I downloaded git sources from master and built it with gperftools support (-ltcmalloc). After running `git cherry-pick <some hash>` with a heap-leak checker enabled I got this:

> Have memory regions w/o callers: might report false leaks
> Leak check _main_ detected leaks of 42838782 bytes in 257986 objects
These objects are allocated at
> read-cache.c:1340: struct cache_entry *ce = xmalloc(cache_entry_size(len));

After looking in the code, I found a comment in the function `static void remove_dir_entry(...)`:

/*
 * Release reference to the directory entry (and parents if 0).
 *
 * Note: we do not remove / free the entry because there's no
 * hash.[ch]::remove_hash and dir->next may point to other entries
 * that are still valid, so we must not free the memory.
 */

So, this objects are never freed - by design? Is it a real issue, or do I just misunderstand something?

Next: Felipe Contreras
Message 1 of 9 in “Huge possible memory leak while cherry-picking.”
  1. Лежанкин ИванAug 9, 2013
  2. Felipe ContrerasAug 9, 2013
  3. Лежанкин ИванAug 12, 2013
  4. Felipe ContrerasAug 12, 2013
  5. unpack-trees: plug a memory leakRené Scharfe, Aug 13, 2013
  6. Junio C HamanoAug 13, 2013
  7. René ScharfeAug 13, 2013
  8. Junio C HamanoAug 13, 2013
  9. Felipe ContrerasAug 12, 2013

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.