diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2020-05-11 11:12:29 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2020-05-11 11:12:29 +0000 |
commit | efe84b0f2c3720e98a26a509fd70a9e2307e14db (patch) | |
tree | e42bc81d52bf766d8b669c2f13ba1626b1d72ea9 /vespalib/src/tests/stllike | |
parent | 331679dc85953f6ab6db2706da92722b03277967 (diff) |
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.
Diffstat (limited to 'vespalib/src/tests/stllike')
-rw-r--r-- | vespalib/src/tests/stllike/hash_test.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
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 <vespa/vespalib/stllike/hash_set.hpp> #include <vespa/vespalib/stllike/hash_map.hpp> #include <vespa/vespalib/stllike/hash_map_equal.hpp> +#include <vespa/vespalib/stllike/allocator.h> #include <cstddef> #include <algorithm> @@ -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<uint64_t, allocator_large<uint64_t>>; + 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(); } |