From 82ad6cdafc6cdb4f996b8b626e0c774cf6445759 Mon Sep 17 00:00:00 2001 From: Jianjun Liao Date: Thu, 7 Nov 2024 11:11:08 +0800 Subject: [PATCH] reduce memory usage when get incomplete ranges Signed-off-by: Jianjun Liao --- 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