diff --git a/go.mod b/go.mod index 1c93063..b14d7fd 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ require ( github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792 - github.com/coreos/bbolt v1.3.2 + github.com/coreos/bbolt v1.3.3 github.com/davecgh/go-spew v1.1.1 github.com/golang/protobuf v1.2.0 github.com/jessevdk/go-flags v1.4.0 diff --git a/go.sum b/go.sum index bdc52c6..9902ef3 100644 --- a/go.sum +++ b/go.sum @@ -34,6 +34,8 @@ github.com/coreos/bbolt v0.0.0-20180223184059-7ee3ded59d4835e10f3e7d0f7603c42aa5 github.com/coreos/bbolt v0.0.0-20180223184059-7ee3ded59d4835e10f3e7d0f7603c42aa5e83820/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= github.com/coreos/bbolt v1.3.2 h1:wZwiHHUieZCquLkDL0B8UhzreNWsPHooDAG3q34zk0s= github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= +github.com/coreos/bbolt v1.3.3 h1:n6AiVyVRKQFNb6mJlwESEvvLoDyiTzXX7ORAUlkeBdY= +github.com/coreos/bbolt v1.3.3/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495 h1:6IyqGr3fnd0tM3YxipK27TUskaOVUjU2nG45yzwcQKY= github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= diff --git a/walletdb/bdb/db.go b/walletdb/bdb/db.go index bf34e7a..ab611ba 100644 --- a/walletdb/bdb/db.go +++ b/walletdb/bdb/db.go @@ -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) }