Skip to content

Commit

Permalink
Optimize the initial memory allocation size of LockManager lock queue…
Browse files Browse the repository at this point in the history
… and wait queue
  • Loading branch information
snower committed May 20, 2024
1 parent 312c36b commit 8d4f469
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions server/lock.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func (self *LockManager) AddLock(lock *Lock) *Lock {
self.currentLock = lock
} else {
if self.locks == nil {
self.locks = NewLockQueue(4, 16, 4)
self.locks = NewLockQueue(4, 4, 4)
self.lockMaps = make(map[[16]byte]*Lock, 8)
}
_ = self.locks.Push(lock)
Expand Down Expand Up @@ -246,7 +246,7 @@ func (self *LockManager) UpdateLockedLock(lock *Lock, command *protocol.LockComm

func (self *LockManager) AddWaitLock(lock *Lock) *Lock {
if self.waitLocks == nil {
self.waitLocks = NewLockQueue(4, 32, 4)
self.waitLocks = NewLockQueue(4, 4, 4)
}
_ = self.waitLocks.Push(lock)
lock.refCount++
Expand Down

0 comments on commit 8d4f469

Please sign in to comment.