Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tag.c
diff options
context:
space:
mode:
authorSergey Vlasov <vsu@altlinux.ru>2005-11-15 19:08:08 +0300
committerJunio C Hamano <junkio@cox.net>2005-11-15 22:42:29 +0300
commit4a4e6fd74f7d4564ed43eaaf59b6bd70c1959f1a (patch)
tree505862d83f5f0ffae0a2d024e7d0bfb336ddf560 /tag.c
parent545f229a4b43212e683ac63e5aa740324ac7799e (diff)
Rework object refs tracking to reduce memory usage
Store pointers to referenced objects in a variable sized array instead of linked list. This cuts down memory usage of utilities which use object references; e.g., git-fsck-objects --full on the git.git repository consumes about 2 MB of memory tracked by Massif instead of 7 MB before the change. Object refs are still the biggest consumer of memory (57%), but the malloc overhead for a single block instead of a linked list is substantially smaller. Signed-off-by: Sergey Vlasov <vsu@altlinux.ru> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'tag.c')
-rw-r--r--tag.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/tag.c b/tag.c
index e574c4b7a4..61ac434d6b 100644
--- a/tag.c
+++ b/tag.c
@@ -75,8 +75,11 @@ int parse_tag_buffer(struct tag *item, void *data, unsigned long size)
item->tag[taglen] = '\0';
item->tagged = lookup_object_type(object, type);
- if (item->tagged)
- add_ref(&item->object, item->tagged);
+ if (item->tagged && track_object_refs) {
+ struct object_refs *refs = alloc_object_refs(1);
+ refs->ref[0] = item->tagged;
+ set_object_refs(&item->object, refs);
+ }
return 0;
}