rafasc reported on IRC that on a repository with a lot of branches, tags, remotes, and commits, name-rev --stdin could use a massive amount of memory (more than 2GB of RAM) to complete. This patch series tries to improve name-rev’s memory usage. There is some improvement that could be done, such as reference counting the names attributed to commits. Tell me if it could be worth to pursue this way, or if name-rev’s internals would need a more thorough rewrite. This is based on master (8104ec994e, "Git 2.21"). The tip of this series is tagged as "fix-name-rev-leak-rfc-v1" in https://github.com/agrn/git. Alban Gruin (4): name-rev: improve name_rev() memory usage commit-list: add a function to check if a commit is in a list name-rev: check if a commit should be named before naming it name-rev: avoid naming from a ref if it’s not a descendant of any commit builtin/name-rev.c | 124 +++++++++++++++++++++++++++++++++++---------- commit.c | 12 +++++ commit.h | 1 + 3 files changed, 111 insertions(+), 26 deletions(-) -- 2.20.1