Skip to content

Commit

Permalink
Remove retainer.
Browse files Browse the repository at this point in the history
  • Loading branch information
evoskuil committed Aug 12, 2024
1 parent 0e212c1 commit 3a355a5
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 15 deletions.
6 changes: 0 additions & 6 deletions include/bitcoin/network/memory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ class BCT_API memory
public:
/// Get memory arena.
virtual arena* get_arena() NOEXCEPT = 0;

/// Get memory retainer.
virtual retainer::ptr get_retainer(size_t allocation=zero) NOEXCEPT = 0;
};

/// Default tracked memory implementation (untracked).
Expand All @@ -48,9 +45,6 @@ class BCT_API default_memory final

/// Get memory arena (system default).
arena* get_arena() NOEXCEPT override;

/// Get memory retainer (empty pointer, allocation unused).
retainer::ptr get_retainer(size_t=zero) NOEXCEPT override;
};

} // namespace network
Expand Down
5 changes: 0 additions & 5 deletions src/memory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,5 @@ arena* default_memory::get_arena() NOEXCEPT
return default_arena::get();
}

retainer::ptr default_memory::get_retainer(size_t) NOEXCEPT
{
return {};
}

} // namespace network
} // namespace libbitcoin
5 changes: 1 addition & 4 deletions src/messages/block.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ typename block::cptr block::deserialize(memory& memory, uint32_t version,
istream source{ data };
byte_reader reader{ source, arena };

// May block until all retainers of the arena are released.
const auto begin = pointer_cast<uint8_t>(arena->require(maximal_block));
const auto message = to_shared(deserialize(version, reader, witness));
if (!reader)
Expand Down Expand Up @@ -109,9 +108,7 @@ typename block::cptr block::deserialize(memory& memory, uint32_t version,
// TODO: system::limit is not necessary if allocation begin < end.
const auto end = pointer_cast<uint8_t>(arena->allocate(zero));
const auto allocated = limit<size_t>(std::distance(begin, end));

// WARNING: retainer does not track objects shared from block (e.g. tx).
message->block_ptr->set_retainer(memory.get_retainer(allocated));
message->block_ptr->set_allocation(allocated);
return message;
}

Expand Down

0 comments on commit 3a355a5

Please sign in to comment.