read-cache: free threaded memory pool

In load_cache_entries_threaded(), each thread allocates its own memory
pool. This pool needs to be cleaned up while closing the threads down,
or it will be leaked.

This ce_mem_pool pointer could theoretically be converted to an inline
copy of the struct, but the use of a pointer helps with existing lazy-
initialization logic. Adjusting that behavior only to avoid this pointer
would be a much bigger change.

Signed-off-by: Derrick Stolee <stolee@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
Derrick Stolee 2024-10-01 17:37:44 +00:00 committed by Junio C Hamano
parent 39bf06adf9
commit 5e6f359f6b
1 changed files with 1 additions and 0 deletions

View File

@ -2187,6 +2187,7 @@ static unsigned long load_cache_entries_threaded(struct index_state *istate, con
if (err) if (err)
die(_("unable to join load_cache_entries thread: %s"), strerror(err)); die(_("unable to join load_cache_entries thread: %s"), strerror(err));
mem_pool_combine(istate->ce_mem_pool, p->ce_mem_pool); mem_pool_combine(istate->ce_mem_pool, p->ce_mem_pool);
free(p->ce_mem_pool);
consumed += p->consumed; consumed += p->consumed;
} }