diff options
author | Russell Yanofsky <russ@yanofsky.org> | 2018-05-18 16:28:50 -0400 |
---|---|---|
committer | João Barbosa <joao.paulo.barbosa@gmail.com> | 2019-03-12 23:24:11 +0000 |
commit | f22d02f5371efcaa48a8d5d1b8cd31c65d8235f3 (patch) | |
tree | 428c6fdaffb12f96bb9e028682c9e7f00cc80a97 /src/hash.cpp | |
parent | 0a9af2d4cb093d254a36d094b8d8ed7603fc9404 (diff) |
Free BerkeleyEnvironment instances when not in use
Instead of adding BerkeleyEnvironment objects permanently to the g_dbenvs map,
use reference counted shared pointers and remove map entries when the last
BerkeleyEnvironment reference goes out of scope.
This change was requested by Matt Corallo <git@bluematt.me> and makes code that
sets up mock databases cleaner. The mock database environment will now go out
of scope and be reset on destruction so there is no need to call
BerkeleyEnvironment::Reset() during wallet construction to clear out prior
state.
This change does affect bitcoin behavior slightly. On startup, instead of same
wallet environments staying open throughout VerifyWallets() and OpenWallets()
calls, VerifyWallets() will open and close an environment once for each wallet,
and OpenWallets() will create its own environment(s) later.
Github-Pull: #11911
Rebased-From: f1f4bb7
Diffstat (limited to 'src/hash.cpp')
0 files changed, 0 insertions, 0 deletions