Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion src/umpire/strategy/FixedSizePool.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,19 @@ class FixedSizePool {

std::size_t numBlocks;

void reversePools()
{
struct Pool* prev = nullptr;
struct Pool* curr = pool;
while (curr) {
struct Pool* next = curr->next;
curr->next = prev;
prev = curr;
curr = next;
}
pool = prev;
}

void newPool(struct Pool **pnew)
{
struct Pool *p = static_cast<struct Pool *>(IA::allocate(sizeof(struct Pool) + NP * sizeof(unsigned int)));
Expand Down Expand Up @@ -109,8 +122,8 @@ class FixedSizePool {

if (!ptr) {
newPool(&prev->next);
reversePools();
ptr = allocate();
// TODO: In this case we should reverse the linked list for optimality
} else {
numBlocks++;
}
Expand Down
Loading