summaryrefslogtreecommitdiff
path: root/src/mongo
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo')
-rw-r--r--src/mongo/util/lru_cache_test.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/mongo/util/lru_cache_test.cpp b/src/mongo/util/lru_cache_test.cpp
index 70cb618d1c2..af3f5c9e208 100644
--- a/src/mongo/util/lru_cache_test.cpp
+++ b/src/mongo/util/lru_cache_test.cpp
@@ -215,7 +215,16 @@ TEST(LRUCacheTest, SizeZeroCache) {
// Test a very large cache size
TEST(LRUCacheTest, StressTest) {
+// If iterator debugging is on the LRU Cache destructor may be O(n^2). Reduce the max iteration size
+// to handle this.
+#if _MSC_VER && _ITERATOR_DEBUG_LEVEL >= 2
+ const int maxSize = 10000;
+ std::array<int, 3> sample{1, 34, 400};
+#else
const int maxSize = 1000000;
+ std::array<int, 5> sample{1, 34, 400, 12345, 999999};
+#endif
+
LRUCache<int, int> cache(maxSize);
// Fill up the cache
@@ -227,7 +236,6 @@ TEST(LRUCacheTest, StressTest) {
assertEquals(cache.size(), size_t(maxSize));
// Perform some basic functions on the cache
- std::array<int, 5> sample{1, 34, 400, 12345, 999999};
for (auto s : sample) {
auto found = cache.find(s);
assertEquals(found->second, s);