repository: MasterIndex.ListPacks / Index.EachByPack allow earlier GC
Allow earlier garbage collection of some of the intermediate data structures.
This commit is contained in:
parent
0d9ac78437
commit
6ff9517e45
2 changed files with 4 additions and 0 deletions
|
@ -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)
|
result.Blobs = append(result.Blobs, idx.toPackedBlob(e, restic.BlobType(typ)).Blob)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// allow GC once entry is no longer necessary
|
||||||
|
byPack[packID] = nil
|
||||||
select {
|
select {
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
return
|
return
|
||||||
|
|
|
@ -458,6 +458,8 @@ func (mi *MasterIndex) ListPacks(ctx context.Context, packs restic.IDSet) <-chan
|
||||||
|
|
||||||
// pass on packs
|
// pass on packs
|
||||||
for packID, pbs := range packBlob {
|
for packID, pbs := range packBlob {
|
||||||
|
// allow GC
|
||||||
|
packBlob[packID] = nil
|
||||||
select {
|
select {
|
||||||
case out <- restic.PackBlobs{PackID: packID, Blobs: pbs}:
|
case out <- restic.PackBlobs{PackID: packID, Blobs: pbs}:
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
|
|
Loading…
Reference in a new issue