From efe84b0f2c3720e98a26a509fd70a9e2307e14db Mon Sep 17 00:00:00 2001 From: Henning Baldersheim Date: Mon, 11 May 2020 11:12:29 +0000 Subject: Use a smart allocator for allocating memory for large 'long' lived vectors. Large vectors will be allocated directly with mmap. This cancels the main reason for using vespalib::Array. --- vespalib/src/tests/stllike/hash_test.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'vespalib/src/tests/stllike') diff --git a/vespalib/src/tests/stllike/hash_test.cpp b/vespalib/src/tests/stllike/hash_test.cpp index d23c2c6b68c..e86a9ad020a 100644 --- a/vespalib/src/tests/stllike/hash_test.cpp +++ b/vespalib/src/tests/stllike/hash_test.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #include @@ -553,4 +554,17 @@ TEST("test that begin and end are identical with empty hashtables") { EXPECT_TRUE(empty_but_reserved.begin() == empty_but_reserved.end()); } +TEST ("test that large_allocator works fine with std::vector") { + using V = std::vector>; + V a; + a.push_back(1); + a.reserve(14); + for (size_t i(0); i < 400000; i++) { + a.push_back(i); + } + V b = std::move(a); + V c = b; + ASSERT_EQUAL(b.size(), c.size()); +} + TEST_MAIN() { TEST_RUN_ALL(); } -- cgit v1.2.3