From 5129bb37dd49d38f0d174e327c92345b4565caf6 Mon Sep 17 00:00:00 2001 From: Jianjun Liao <36503113+Leavrth@users.noreply.github.com> Date: Wed, 13 Nov 2024 11:12:38 +0800 Subject: [PATCH] br: reduce memory usage when get incomplete ranges (#57192) close pingcap/tidb#53529 --- br/pkg/rtree/rtree.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/br/pkg/rtree/rtree.go b/br/pkg/rtree/rtree.go index d487fb70de9ba..aefa1343d4150 100644 --- a/br/pkg/rtree/rtree.go +++ b/br/pkg/rtree/rtree.go @@ -418,7 +418,8 @@ func (rangeTree *ProgressRangeTree) Iter() *IncompleteRangesFetcher { } func (iter *IncompleteRangesFetcher) GetIncompleteRanges() []Range { - incompleteRanges := make([]Range, 0, 64*len(iter.items)) + // about 64 MB memory if there are 1 million ranges + incompleteRanges := make([]Range, 0, len(iter.items)) for _, item := range iter.items { if item.complete { continue