]> git.ipfire.org Git - thirdparty/git.git/commit
refs: implement releasing ref storages
authorPatrick Steinhardt <ps@pks.im>
Fri, 17 May 2024 08:18:24 +0000 (10:18 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 17 May 2024 17:33:37 +0000 (10:33 -0700)
commit71c871b48dfaf300ca20e205917db72ab9c6d7b3
tree6b8c0fc18c2816d38e7c554c9f7d90e975a034bc
parented93ea16025decb60eb91308d682884e263e6f85
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>
refs.c
refs.h
refs/debug.c
refs/files-backend.c
refs/packed-backend.c
refs/refs-internal.h
refs/reftable-backend.c