diff options
author | Carlos Martín Nieto <cmn@dwim.me> | 2012-12-21 16:46:48 +0400 |
---|---|---|
committer | Carlos Martín Nieto <cmn@dwim.me> | 2013-01-11 20:32:59 +0400 |
commit | 0ed756200693aed93c4c9fb4f8776196fec5a971 (patch) | |
tree | 4274bf1f28278fc167ea302a579df9f492c69e78 /src/pack.h | |
parent | c8f79c2bdf9dd237d5c407526bcfc20d4eff5e64 (diff) |
pack: limit the amount of memory the base delta cache can use
Currently limited to 16MB (like git) and to objects up to 1MB in
size.
Diffstat (limited to 'src/pack.h')
-rw-r--r-- | src/pack.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/pack.h b/src/pack.h index 4e5c12765..db57e57d2 100644 --- a/src/pack.h +++ b/src/pack.h @@ -54,7 +54,7 @@ struct git_pack_idx_header { }; typedef struct git_pack_cache_entry { - int uses; /* enough? */ + size_t last_usage; /* enough? */ git_atomic refcount; git_rawobj raw; } git_pack_cache_entry; @@ -63,11 +63,13 @@ typedef struct git_pack_cache_entry { GIT__USE_OFFMAP; -#define GIT_PACK_CACHE_MEMORY_LIMIT 2 * 1024 * 1024; +#define GIT_PACK_CACHE_MEMORY_LIMIT 16 * 1024 * 1024 +#define GIT_PACK_CACHE_SIZE_LIMIT 1024 * 1024 /* don't bother caching anything over 1MB */ typedef struct { size_t memory_used; size_t memory_limit; + size_t use_ctr; git_mutex lock; git_offmap *entries; } git_pack_cache; |