diff --git a/ledis/t_zset.go b/ledis/t_zset.go index 7cf753a..fe11df8 100644 --- a/ledis/t_zset.go +++ b/ledis/t_zset.go @@ -583,9 +583,10 @@ func (db *DB) zRange(key []byte, min int64, max int64, offset int, count int, re return []ScorePair{}, nil } - nv := 64 - if count > 0 { - nv = count + nv := count + // count may be very large, so we must limit it for below mem make. + if nv <= 0 || nv > 1024 { + nv = 64 } v := make([]ScorePair, 0, nv)