mirror of
https://github.com/git/git
synced 2024-09-13 21:34:42 +00:00
Merge branch 'ew/free-island-marks'
"git pack-objects" learned to release delta-island bitmap data when it is done using it, saving peak heap memory usage. * ew/free-island-marks: delta-islands: free island_marks and bitmaps
This commit is contained in:
commit
6d1b2e48fe
|
@ -929,8 +929,10 @@ static struct object_entry **compute_write_order(void)
|
|||
*/
|
||||
for_each_tag_ref(mark_tagged, NULL);
|
||||
|
||||
if (use_delta_islands)
|
||||
if (use_delta_islands) {
|
||||
max_layers = compute_pack_layers(&to_pack);
|
||||
free_island_marks();
|
||||
}
|
||||
|
||||
ALLOC_ARRAY(wo, to_pack.nr_objects);
|
||||
wo_end = 0;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -14,5 +14,6 @@ void resolve_tree_islands(struct repository *r,
|
|||
void load_delta_islands(struct repository *r, int progress);
|
||||
void propagate_island_marks(struct commit *commit);
|
||||
int compute_pack_layers(struct packing_data *to_pack);
|
||||
void free_island_marks(void);
|
||||
|
||||
#endif /* DELTA_ISLANDS_H */
|
||||
|
|
Loading…
Reference in a new issue