diff options
author | Patrick Steinhardt <ps@pks.im> | 2024-05-17 10:18:24 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-05-17 19:33:37 +0200 |
commit | 71c871b48dfaf300ca20e205917db72ab9c6d7b3 (patch) | |
tree | 6b8c0fc18c2816d38e7c554c9f7d90e975a034bc /refs.h | |
parent | refs: rename `init_db` callback to avoid confusion (diff) | |
download | git-71c871b48dfaf300ca20e205917db72ab9c6d7b3.tar.xz git-71c871b48dfaf300ca20e205917db72ab9c6d7b3.zip |
refs: implement releasing ref storages
Ref storages are typically only initialized once for `the_repository`
and then never released. Until now we got away with that without causing
memory leaks because `the_repository` stays reachable, and because the
ref backend is reachable via `the_repository` its memory basically never
leaks.
This is about to change though because of the upcoming migration logic,
which will create a secondary ref storage. In that case, we will either
have to release the old or new ref storage to avoid leaks.
Implement a new `release` callback and expose it via a new
`ref_storage_release()` function.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'refs.h')
-rw-r--r-- | refs.h | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -119,6 +119,11 @@ int is_branch(const char *refname); int ref_store_create_on_disk(struct ref_store *refs, int flags, struct strbuf *err); /* + * Release all memory and resources associated with the ref store. + */ +void ref_store_release(struct ref_store *ref_store); + +/* * Return the peeled value of the oid currently being iterated via * for_each_ref(), etc. This is equivalent to calling: * |