Skip to content

Commit

Permalink
fix reallocation issue
Browse files Browse the repository at this point in the history
  • Loading branch information
lroberts36 committed Oct 24, 2024
1 parent 59c8680 commit dc54426
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/utils/communication_buffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,11 @@ class CommBuffer {
T &buffer() { return buf_; }
const T &buffer() const { return buf_; }

void Allocate(int size = 0) {
buf_ = get_resource_(size);
active_ = true;
void Allocate(int size = -1) {
if (!active_ || (size > 0 && buf_.size() != size)) {
buf_ = get_resource_(size);
active_ = true;
}
}

template <class... Args>
Expand Down

0 comments on commit dc54426

Please sign in to comment.