On Thu, Jun 12, 2014 at 11:15:49AM -0700, Junio C Hamano wrote:

> Why do we need an initialiser at this point (in other words, how
> have other existing slab users coped without having one)?
> I think they call init_*_slab() when the slab is needed/used the
> first time (e.g. it is not even worth initialising indegree slab
> unless we are sorting in topo order).
> Unlike the author-date and indegree slabs, there are too many entry
> points that may want access to the buffer slab (save_commit_buffer's
> default being on does not help us either), so it would be much less
> error prone to always initialise a static slab like this patch does,
> I guess.

Yes, and also because the lifetime of this slab is different. For the
indegree and author-date slabs, the slab lives for one operation.  So we
init the slab at the beginning of the operation, do the sort, then clear
it at the end.

This slab does not exist for one operation. It is a global cache that
can be used by any code, just like the "struct commit" cache itself.. It
should always be initialized from the start, and continue until the
program exits.

To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to