Re: [PATCH] process_{tree,blob}: Remove useless xstrdup calls
- From
Linus Torvalds <torvalds@linux-foundation.org>
- Date
- Apr 11, 2009, 19:58 UTC
- Message-ID
- <alpine.LFD.2.00.0904111255530.4583@localhost.localdomain>
- In-Reply-To
- <20090411194000.GB21300@atjola.homenet>
On Sat, 11 Apr 2009, Björn Steinbrink wrote:
Show 8 quoted lines
> > No, this is x86-64, 8 byte pointers. But the savings are trivially > explained I think. The struct object_array things are 20 bytes here (per > object overhead!), so that's about 5M * 20 = 100M. And the average name > length for the objects was 19 bytes, which means about another 100M. > Both, the object_array stuff as well as the path names, were allocated > and never freed. Your patch removed the object_array stuff, and it made > the memory allocations for the names temporary. Right?
Right.
My original one-liner patch just did the name freeing part, but it did so only at the _end_ (when actually calling show_object()), so it probably didn't help RSS very much - because you still had one point in time where you had all the names allocated. It probably helped packing (since it allocates more _afterwards_), but likely didn't make much of a difference for just 'git rev-list".
So that was the impetus for trying to just avoid the "keep all objects around on the 'object_array' thing" patch, and then cleaning up the show_object() call semantics.
Linus