Re: [RFC PATCH 1/4] name-rev: improve name_rev() memory usage
- Date: Fri, 1 Mar 2019 13:44:57 -0500
- From: Jeff King <peff@xxxxxxxx>
- Subject: Re: [RFC PATCH 1/4] name-rev: improve name_rev() memory usage
On Fri, Mar 01, 2019 at 06:50:21PM +0100, Alban Gruin wrote:
> name_rev() is a recursive function. For each commit, it allocates the
> name of its parents, and call itself. A parent may not use a name for
> multiple reasons, but in any case, the name will not be released. On a
> repository with a lot of branches, tags, remotes, and commits, it can
> use more than 2GB of RAM.
I don't know name-rev that well, so I didn't look super carefully at
your patch. But if it's recursive in history, that's almost certainly
going to be a problem for some histories on some platforms. We've had to
de-recursify several other algorithms (e.g., "tag --contains") because
of stack space issues.
Which isn't to say what you're doing here might not be separately
useful, but just know that in the long run that's probably where we'd
need to take this.