]> git.99rst.org Git - git.git/commitdiff
read-cache: free threaded memory pool
authorDerrick Stolee <redacted>
Tue, 1 Oct 2024 17:37:44 +0000 (17:37 +0000)
committerJunio C Hamano <redacted>
Tue, 1 Oct 2024 18:51:15 +0000 (11:51 -0700)
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 <redacted>
Signed-off-by: Junio C Hamano <redacted>
read-cache.c

index 48bf24f87c00c15e5a4b249b26eabc624546f901..3b76a1f5d565318da85996ebb6fdb6265196abfa 100644 (file)
@@ -2187,6 +2187,7 @@ static unsigned long load_cache_entries_threaded(struct index_state *istate, con
                if (err)
                        die(_("unable to join load_cache_entries thread: %s"), strerror(err));
                mem_pool_combine(istate->ce_mem_pool, p->ce_mem_pool);
+               free(p->ce_mem_pool);
                consumed += p->consumed;
        }
 
git clone https://git.99rst.org/PROJECT