diff options
author | Eric Wong <e@80x24.org> | 2023-02-04 02:44:30 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-02-04 05:01:46 +0300 |
commit | 647982bb7171b2409f2a90da245b8a31913f930f (patch) | |
tree | 07573d1e5c8b2117fbe301ccd5b8c67415ea589f /delta-islands.c | |
parent | 844ede312b4e988881b6e27e352f469d8ab80b2a (diff) |
delta-islands: free island_marks and bitmaps
On my mirror of linux.git forkgroup with 780 islands, this saves
nearly 4G of heap memory in pack-objects. This savings only
benefits delta island users of pack bitmaps, as the process
would otherwise be exiting anyways.
However, there's probably not many delta island users, but the
majority of delta island users would also be pack bitmaps users.
Signed-off-by: Eric Wong <e@80x24.org>
Helped-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'delta-islands.c')
-rw-r--r-- | delta-islands.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/delta-islands.c b/delta-islands.c index 90c0d6958f..8b234cb85b 100644 --- a/delta-islands.c +++ b/delta-islands.c @@ -513,6 +513,20 @@ void propagate_island_marks(struct commit *commit) } } +void free_island_marks(void) +{ + struct island_bitmap *bitmap; + + kh_foreach_value(island_marks, bitmap, { + if (!--bitmap->refcount) + free(bitmap); + }); + kh_destroy_oid_map(island_marks); + + /* detect use-after-free with a an address which is never valid: */ + island_marks = (void *)-1; +} + int compute_pack_layers(struct packing_data *to_pack) { uint32_t i; |