bdb: specify freelist options by default
This commit specifies two bbolt options when opening the bbolt db. This reduces heap pressure in case there are a lot of pages on the freelist.
This commit is contained in:
parent
604661be3d
commit
e809748b1e
1 changed files with 8 additions and 1 deletions
|
@ -344,6 +344,13 @@ func openDB(dbPath string, create bool) (walletdb.DB, error) {
|
|||
return nil, walletdb.ErrDbDoesNotExist
|
||||
}
|
||||
|
||||
boltDB, err := bbolt.Open(dbPath, 0600, nil)
|
||||
// Specify bbolt freelist options to reduce heap pressure in case the
|
||||
// freelist grows to be very large.
|
||||
options := &bbolt.Options{
|
||||
NoFreelistSync: true,
|
||||
FreelistType: bbolt.FreelistMapType,
|
||||
}
|
||||
|
||||
boltDB, err := bbolt.Open(dbPath, 0600, options)
|
||||
return (*db)(boltDB), convertErr(err)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue