Skip to content

Commit

Permalink
change largevector to not pre-populate mapping (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
meyerzinn authored Apr 21, 2024
1 parent bd29284 commit a0fbf92
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libgalois/include/galois/LargeVector.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ class LargeVector : public boost::noncopyable {
size_t const mmap_size =
std::max(m_mappings.front().second * 2, m_capacity * sizeof(T));

m_data = static_cast<T*>(mmap(nullptr, mmap_size, PROT_READ | PROT_WRITE,
MAP_SHARED | MAP_POPULATE, m_fd, 0));
m_data = static_cast<T*>(
mmap(nullptr, mmap_size, PROT_READ | PROT_WRITE, MAP_SHARED, m_fd, 0));
if (m_data == MAP_FAILED)
throw std::runtime_error(std::string("mmap failed: ") +
std::strerror(errno));
Expand Down
4 changes: 4 additions & 0 deletions libgalois/test/large-vector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ int main() {
the_vector.resize(0);
GALOIS_ASSERT(num_destructed == max_cap);
GALOIS_ASSERT(addr == &the_vector[max_cap]);

// this should not actually allocate memory!
galois::LargeVector<char> huge(1ul << 40);
huge[0] = 0;
}

return 0;
Expand Down

0 comments on commit a0fbf92

Please sign in to comment.