Skip to content

Commit

Permalink
#871: MemoryPoolEqual changed to FixedSizePool
Browse files Browse the repository at this point in the history
  • Loading branch information
Braden Mailloux committed Nov 20, 2020
1 parent 386023a commit c12a06d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/vt/pool/pool.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ struct Pool : runtime::component::Component<Pool> {
using HeaderType = Header;
using HeaderManagerType = HeaderManager;
template <int64_t num_bytes_t>
using MemoryPoolType = MemoryPoolEqual<num_bytes_t>;
using MemoryPoolType = FixedSizePool<num_bytes_t>;
template <int64_t num_bytes_t>
using MemoryPoolPtrType = std::unique_ptr<MemoryPoolType<num_bytes_t>>;

Expand Down
18 changes: 9 additions & 9 deletions src/vt/pool/static_sized/memory_pool_equal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@
namespace vt { namespace pool {

template <int64_t num_bytes_t>
MemoryPoolEqual<num_bytes_t>::MemoryPoolEqual(SlotType const in_pool_size)
FixedSizePool<num_bytes_t>::FixedSizePool(SlotType const in_pool_size)
: pool_size_(in_pool_size)
{
resizePool();
}

template <int64_t num_bytes_t>
/*virtual*/ MemoryPoolEqual<num_bytes_t>::~MemoryPoolEqual() {
/*virtual*/ FixedSizePool<num_bytes_t>::~FixedSizePool() {
vt_debug_print(
pool, node,
"cur_slot_={}\n", cur_slot_
Expand All @@ -79,7 +79,7 @@ template <int64_t num_bytes_t>
}

template <int64_t num_bytes_t>
void* MemoryPoolEqual<num_bytes_t>::alloc(
void* FixedSizePool<num_bytes_t>::alloc(
size_t const& sz, size_t const& oversize
) {
if (static_cast<size_t>(cur_slot_ + 1) >= holder_.size()) {
Expand Down Expand Up @@ -109,7 +109,7 @@ void* MemoryPoolEqual<num_bytes_t>::alloc(
}

template <int64_t num_bytes_t>
void MemoryPoolEqual<num_bytes_t>::dealloc(void* const t) {
void FixedSizePool<num_bytes_t>::dealloc(void* const t) {
vt_debug_print(
pool, node,
"dealloc t={}, cur_slot={}\n", t, cur_slot_
Expand All @@ -126,7 +126,7 @@ void MemoryPoolEqual<num_bytes_t>::dealloc(void* const t) {
}

template <int64_t num_bytes_t>
void MemoryPoolEqual<num_bytes_t>::resizePool() {
void FixedSizePool<num_bytes_t>::resizePool() {
SlotType const cur_size = holder_.size();
SlotType const new_size = cur_size == 0 ? pool_size_ : cur_size * 2;

Expand All @@ -138,12 +138,12 @@ void MemoryPoolEqual<num_bytes_t>::resizePool() {
}

template <int64_t num_bytes_t>
typename MemoryPoolEqual<num_bytes_t>::SlotType
MemoryPoolEqual<num_bytes_t>::getNumBytes() {
typename FixedSizePool<num_bytes_t>::SlotType
FixedSizePool<num_bytes_t>::getNumBytes() {
return num_bytes_;
}

template struct MemoryPoolEqual<memory_size_small>;
template struct MemoryPoolEqual<memory_size_medium>;
template struct FixedSizePool<memory_size_small>;
template struct FixedSizePool<memory_size_medium>;

}} //end namespace vt::pool

0 comments on commit c12a06d

Please sign in to comment.