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
diff options
context:
space:
mode:
authorStefan Beller <sbeller@google.com>2018-05-08 22:37:24 +0300
committerJunio C Hamano <gitster@pobox.com>2018-05-09 06:12:36 +0300
commit99bf115c879af7e38ef0ca9596fc9db1d6598d5f (patch)
tree1649347a2a4a8b94495b1d95782249f3943346d5 /repository.c
parent9d98354f48997faf8251c566d909957f6ae427d5 (diff)
repository: introduce parsed objects field
Convert the existing global cache for parsed objects (obj_hash) into repository-specific parsed object caches. Existing code that uses obj_hash are modified to use the parsed object cache of the_repository; future patches will use the parsed object caches of other repositories. Another future use case for a pool of objects is ease of memory management in revision walking: If we can free the rev-list related memory early in pack-objects (e.g. part of repack operation) then it could lower memory pressure significantly when running on large repos. While this has been discussed on the mailing list lately, this series doesn't implement this. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'repository.c')
-rw-r--r--repository.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/repository.c b/repository.c
index a4848c1bd0..c23404677e 100644
--- a/repository.c
+++ b/repository.c
@@ -2,6 +2,7 @@
#include "repository.h"
#include "object-store.h"
#include "config.h"
+#include "object.h"
#include "submodule-config.h"
/* The main repository */
@@ -14,6 +15,8 @@ void initialize_the_repository(void)
the_repo.index = &the_index;
the_repo.objects = raw_object_store_new();
+ the_repo.parsed_objects = parsed_object_pool_new();
+
repo_set_hash_algo(&the_repo, GIT_HASH_SHA1);
}
@@ -143,6 +146,7 @@ static int repo_init(struct repository *repo,
memset(repo, 0, sizeof(*repo));
repo->objects = raw_object_store_new();
+ repo->parsed_objects = parsed_object_pool_new();
if (repo_init_gitdir(repo, gitdir))
goto error;
@@ -226,6 +230,9 @@ void repo_clear(struct repository *repo)
raw_object_store_clear(repo->objects);
FREE_AND_NULL(repo->objects);
+ parsed_object_pool_clear(repo->parsed_objects);
+ FREE_AND_NULL(repo->parsed_objects);
+
if (repo->config) {
git_configset_clear(repo->config);
FREE_AND_NULL(repo->config);