2
2
mirror of https://github.com/octoleo/restic.git synced 2024-12-26 12:27:33 +00:00

repository: MasterIndex.ListPacks / Index.EachByPack allow earlier GC

Allow earlier garbage collection of some of the intermediate data
structures.
This commit is contained in:
Michael Eischer 2022-08-19 21:06:33 +02:00
parent 0d9ac78437
commit 6ff9517e45
2 changed files with 4 additions and 0 deletions

View File

@ -294,6 +294,8 @@ func (idx *Index) EachByPack(ctx context.Context, packBlacklist restic.IDSet) <-
result.Blobs = append(result.Blobs, idx.toPackedBlob(e, restic.BlobType(typ)).Blob)
}
}
// allow GC once entry is no longer necessary
byPack[packID] = nil
select {
case <-ctx.Done():
return

View File

@ -458,6 +458,8 @@ func (mi *MasterIndex) ListPacks(ctx context.Context, packs restic.IDSet) <-chan
// pass on packs
for packID, pbs := range packBlob {
// allow GC
packBlob[packID] = nil
select {
case out <- restic.PackBlobs{PackID: packID, Blobs: pbs}:
case <-ctx.Done():