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?