Skip to content

Commit 1e15fea

Browse files
committed
commit some suggestions
Signed-off-by: Jianjun Liao <[email protected]>
1 parent d9c42cb commit 1e15fea

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

br/cmd/br/cmd.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,12 @@ func Init(cmd *cobra.Command) (err error) {
206206
// BR command needs 256 MiB at least, if the left memory is less than 256 MiB,
207207
// the memory limit cannot limit anyway and then finally OOM.
208208
memlimit = mathutil.Max(memlimit, quarterGiB)
209-
log.Info("calculate the rest memory and set memory limit",
209+
log.Info("calculate the rest memory",
210210
zap.Uint64("memtotal", memtotal), zap.Uint64("memused", memused), zap.Uint64("memlimit", memlimit))
211-
debug.SetMemoryLimit(int64(memlimit & math.MaxInt64))
211+
// No need to set memory limit because the left memory is sufficient.
212+
if memlimit < uint64(math.MaxInt64) {
213+
debug.SetMemoryLimit(int64(memlimit))
214+
}
212215
}
213216
}
214217

0 commit comments

Comments
 (0)