diff --git a/internal/repository/index.go b/internal/repository/index.go index 8978b60d5..767357eb3 100644 --- a/internal/repository/index.go +++ b/internal/repository/index.go @@ -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 diff --git a/internal/repository/master_index.go b/internal/repository/master_index.go index 955080e82..058a3a662 100644 --- a/internal/repository/master_index.go +++ b/internal/repository/master_index.go @@ -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():