diff --git a/log_unstable.go b/log_unstable.go index f637b611..434d23eb 100644 --- a/log_unstable.go +++ b/log_unstable.go @@ -168,17 +168,8 @@ func (u *unstable) stableTo(id entryID) { // potentially large entries that aren't needed anymore. Simply clearing the // entries wouldn't be safe because clients might still be using them. func (u *unstable) shrinkEntriesArray() { - // We replace the array if we're using less than half of the space in - // it. This number is fairly arbitrary, chosen as an attempt to balance - // memory usage vs number of allocations. It could probably be improved - // with some focused tuning. - const lenMultiple = 2 if len(u.entries) == 0 { u.entries = nil - } else if len(u.entries)*lenMultiple < cap(u.entries) { - newEntries := make([]*pb.Entry, len(u.entries)) - copy(newEntries, u.entries) - u.entries = newEntries } }