Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
pack-objects: only throw away data during memory pressure
author
Martin Koegler
<mkoegler@auto.tuwien.ac.at>
Mon, 11 Feb 2008 07:26:25 +0000
(08:26 +0100)
committer
Junio C Hamano
<gitster@pobox.com>
Mon, 11 Feb 2008 20:24:33 +0000
(12:24 -0800)
If pack-objects hit the memory limit, it deletes objects from the delta
window.
This patch make it only delete the data, which is recomputed, if needed again.
Signed-off-by: Martin Koegler <mkoegler@auto.tuwien.ac.at>
Acked-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-pack-objects.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
5a95b85
)
diff --git
a/builtin-pack-objects.c
b/builtin-pack-objects.c
index d3efeff03f89cc0f4d0da463ddf878c28effb31e..4113f013cfae060cc21719a421e98d1741752f9b 100644
(file)
--- a/
builtin-pack-objects.c
+++ b/
builtin-pack-objects.c
@@
-1464,7
+1464,7
@@
static unsigned int check_delta_limit(struct object_entry *me, unsigned int n)
return m;
}
return m;
}
-static unsigned long free_unpacked(struct unpacked *n)
+static unsigned long free_unpacked
_data
(struct unpacked *n)
{
unsigned long freed_mem = sizeof_delta_index(n->index);
free_delta_index(n->index);
{
unsigned long freed_mem = sizeof_delta_index(n->index);
free_delta_index(n->index);
@@
-1474,6
+1474,12
@@
static unsigned long free_unpacked(struct unpacked *n)
free(n->data);
n->data = NULL;
}
free(n->data);
n->data = NULL;
}
+ return freed_mem;
+}
+
+static unsigned long free_unpacked(struct unpacked *n)
+{
+ unsigned long freed_mem = free_unpacked_data(n);
n->entry = NULL;
n->depth = 0;
return freed_mem;
n->entry = NULL;
n->depth = 0;
return freed_mem;
@@
-1514,7
+1520,7
@@
static void find_deltas(struct object_entry **list, unsigned *list_size,
mem_usage > window_memory_limit &&
count > 1) {
uint32_t tail = (idx + window - count) % window;
mem_usage > window_memory_limit &&
count > 1) {
uint32_t tail = (idx + window - count) % window;
- mem_usage -= free_unpacked(array + tail);
+ mem_usage -= free_unpacked
_data
(array + tail);
count--;
}
count--;
}
@@
-1547,6
+1553,9
@@
static void find_deltas(struct object_entry **list, unsigned *list_size,
if (!m->entry)
break;
ret = try_delta(n, m, max_depth, &mem_usage);
if (!m->entry)
break;
ret = try_delta(n, m, max_depth, &mem_usage);
+ if (window_memory_limit &&
+ mem_usage > window_memory_limit)
+ mem_usage -= free_unpacked_data(m);
if (ret < 0)
break;
else if (ret > 0)
if (ret < 0)
break;
else if (ret > 0)