From a9a60f77ced8c8ecbca2d09795c7574c71715b13 Mon Sep 17 00:00:00 2001 From: Michael Eischer Date: Sat, 29 Jun 2024 17:24:47 +0200 Subject: [PATCH] restore: optimize memory usage --- internal/restorer/restorer.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/restorer/restorer.go b/internal/restorer/restorer.go index 650ad0731..3817414eb 100644 --- a/internal/restorer/restorer.go +++ b/internal/restorer/restorer.go @@ -120,7 +120,9 @@ func (res *Restorer) traverseTree(ctx context.Context, target, location string, return hasRestored, res.Error(location, err) } - for _, node := range tree.Nodes { + for i, node := range tree.Nodes { + // allow GC of tree node + tree.Nodes[i] = nil // ensure that the node name does not contain anything that refers to a // top-level directory.