summaryrefslogtreecommitdiff
path: root/builtin-pack-objects.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2009-09-07 15:23:50 -0700
committerJunio C Hamano <gitster@pobox.com>2009-09-07 15:23:50 -0700
commit8e4384fd4438a143af7125eb0f03312a318319fb (patch)
tree291180389c88c849627dc1f0181c9b8cc87b5a02 /builtin-pack-objects.c
parent6ea71fe7d36cf5b81c2100d97a822ecf0bc04746 (diff)
parent0ef95f72f878184fbce8d7c855ab4346c081abed (diff)
downloadgit-8e4384fd4438a143af7125eb0f03312a318319fb.tar.gz
Merge branch 'np/maint-1.6.3-deepen'
* np/maint-1.6.3-deepen: pack-objects: free preferred base memory after usage make shallow repository deepening more network efficient
Diffstat (limited to 'builtin-pack-objects.c')
-rw-r--r--builtin-pack-objects.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c
index 1ff2ce6df4..7a390e1d44 100644
--- a/builtin-pack-objects.c
+++ b/builtin-pack-objects.c
@@ -1008,6 +1008,33 @@ static void add_preferred_base(unsigned char *sha1)
it->pcache.tree_size = size;
}
+static void cleanup_preferred_base(void)
+{
+ struct pbase_tree *it;
+ unsigned i;
+
+ it = pbase_tree;
+ pbase_tree = NULL;
+ while (it) {
+ struct pbase_tree *this = it;
+ it = this->next;
+ free(this->pcache.tree_data);
+ free(this);
+ }
+
+ for (i = 0; i < ARRAY_SIZE(pbase_tree_cache); i++) {
+ if (!pbase_tree_cache[i])
+ continue;
+ free(pbase_tree_cache[i]->tree_data);
+ free(pbase_tree_cache[i]);
+ pbase_tree_cache[i] = NULL;
+ }
+
+ free(done_pbase_paths);
+ done_pbase_paths = NULL;
+ done_pbase_paths_num = done_pbase_paths_alloc = 0;
+}
+
static void check_object(struct object_entry *entry)
{
if (entry->in_pack) {
@@ -2312,6 +2339,7 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
rp_av[rp_ac] = NULL;
get_object_list(rp_ac, rp_av);
}
+ cleanup_preferred_base();
if (include_tag && nr_result)
for_each_ref(add_ref_tag, NULL);
stop_progress(&progress_state);