Page MenuHomePhabricator

Free BerkeleyEnvironment instances when not in use

Authored by Fabien on Fri, Jan 10, 21:21.


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.

Backport of core PR11911 and PR15322:

This should fix ASAN and TSAN.

Depends on D4888.

Test Plan
ninja all check
./test/functional/ wallet_*

ABC_BUILD_NAME=build-asan ./contrib/teamcity/
ABC_BUILD_NAME=build-tsan ./contrib/teamcity/

Diff Detail

rABC Bitcoin ABC
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Fabien created this revision.Fri, Jan 10, 21:21
Herald added a reviewer: Restricted Project. · View Herald TranscriptFri, Jan 10, 21:21
jasonbcox requested changes to this revision.Fri, Jan 10, 22:36
jasonbcox added a subscriber: jasonbcox.

Everything looks good except for the one missed line in the comment.

62 ↗(On Diff #15315)

s/ open//g

This revision now requires changes to proceed.Fri, Jan 10, 22:36
Fabien added inline comments.Sat, Jan 11, 05:58
62 ↗(On Diff #15315)

Good catch !

Fabien updated this revision to Diff 15327.Sat, Jan 11, 05:58

Fix comment.

deadalnix accepted this revision.Sat, Jan 11, 13:11
deadalnix added inline comments.
76 ↗(On Diff #15327)


108 ↗(On Diff #15327)


jasonbcox accepted this revision.Sat, Jan 11, 16:50
This revision is now accepted and ready to land.Sat, Jan 11, 16:50
This revision was automatically updated to reflect the committed changes.