[everything] Fix circular shared pointer references.
We had a cycle from transaction_manager <-> space_map, and also from the ref_counters back up to the tm. This prevented objects being destroyed when various programs exited. From now on we'll try and only use a shared ptr if ownership is implied. Otherwise a reference will be used (eg, for up pointers).
This commit is contained in:
@ -37,7 +37,9 @@ namespace {
|
||||
class ArrayTests : public Test {
|
||||
public:
|
||||
ArrayTests()
|
||||
: tm_(create_tm()) {
|
||||
: bm_(new block_manager<>("./test.data", NR_BLOCKS, 4, block_manager<>::READ_WRITE)),
|
||||
sm_(new core_map(NR_BLOCKS)),
|
||||
tm_(bm_, sm_) {
|
||||
}
|
||||
|
||||
void
|
||||
@ -76,15 +78,9 @@ namespace {
|
||||
array64::ptr a_;
|
||||
|
||||
private:
|
||||
static transaction_manager::ptr
|
||||
create_tm() {
|
||||
block_manager<>::ptr bm(new block_manager<>("./test.data", NR_BLOCKS, 4, block_manager<>::READ_WRITE));
|
||||
space_map::ptr sm(new core_map(NR_BLOCKS));
|
||||
transaction_manager::ptr tm(new transaction_manager(bm, sm));
|
||||
return tm;
|
||||
}
|
||||
|
||||
transaction_manager::ptr tm_;
|
||||
block_manager<>::ptr bm_;
|
||||
space_map::ptr sm_;
|
||||
transaction_manager tm_;
|
||||
};
|
||||
|
||||
class value_visitor {
|
||||
|
Reference in New Issue
Block a user