File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change 2929
3030using namespace irs ;
3131
32+ struct LargeData {
33+ char data[1024 ];
34+ };
35+
36+ TEST (IResearchMemoryLimitTest, no_limit_set_allows_infinite_allocations) {
37+
38+ // The expectation is to allow potentially infinite allocations
39+ // even if we're testing with just 1MB.
40+
41+ // allocate vector
42+ ManagedVector<LargeData> vec;
43+
44+ for (size_t i = 0 ; i < 1024 ; i++) {
45+ ASSERT_NO_THROW (vec.push_back (LargeData ()));
46+ }
47+ }
48+
49+ TEST (IResearchMemoryLimitTest, zero_limit_allow_infinite_allocations) {
50+
51+ auto memoryMgr = IResearchMemoryManager::GetInstance ();
52+ memoryMgr->SetMemoryLimit (0 );
53+
54+ // allocate vector
55+ ManagedVector<LargeData> vec;
56+
57+ for (size_t i = 0 ; i < 1024 ; i++) {
58+ ASSERT_NO_THROW (vec.push_back (LargeData ()));
59+ }
60+ }
61+
3262TEST (IResearchMemoryLimitTest, managed_allocator_smoke_test) {
3363
3464 auto memoryMgr = IResearchMemoryManager::GetInstance ();
You can’t perform that action at this time.
0 commit comments