From a0fbf928c793d4167d87c98b6e61715fa2ec5810 Mon Sep 17 00:00:00 2001 From: Meyer Zinn <6132034+meyerzinn@users.noreply.github.com> Date: Sun, 21 Apr 2024 17:12:48 -0500 Subject: [PATCH] change largevector to not pre-populate mapping (#53) --- libgalois/include/galois/LargeVector.h | 4 ++-- libgalois/test/large-vector.cpp | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/libgalois/include/galois/LargeVector.h b/libgalois/include/galois/LargeVector.h index a10834746..dfdf80f84 100644 --- a/libgalois/include/galois/LargeVector.h +++ b/libgalois/include/galois/LargeVector.h @@ -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(mmap(nullptr, mmap_size, PROT_READ | PROT_WRITE, - MAP_SHARED | MAP_POPULATE, m_fd, 0)); + m_data = static_cast( + 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)); diff --git a/libgalois/test/large-vector.cpp b/libgalois/test/large-vector.cpp index 3ac714de6..313626041 100644 --- a/libgalois/test/large-vector.cpp +++ b/libgalois/test/large-vector.cpp @@ -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 huge(1ul << 40); + huge[0] = 0; } return 0;