diff --git a/CMakeLists.txt b/CMakeLists.txt index fe74d39..acff0ba 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -177,8 +177,25 @@ if(NOT DEFINED SNMALLOC_ONLY_HEADER_LIBRARY) add_test(${TESTNAME} ${TESTNAME}) endif() if (${TEST_CATEGORY} MATCHES "perf") + message(STATUS "Single threaded test: ${TESTNAME}") set_tests_properties(${TESTNAME} PROPERTIES PROCESSORS 4) endif() + if(MSVC) + # On Windows these tests use a lot of memory as it doesn't support + # lazy commit. + if (${TEST} MATCHES "two_alloc_types") + message(STATUS "Single threaded test: ${TESTNAME}") + set_tests_properties(${TESTNAME} PROPERTIES PROCESSORS 4) + endif() + if (${TEST} MATCHES "fixed_region") + message(STATUS "Single threaded test: ${TESTNAME}") + set_tests_properties(${TESTNAME} PROPERTIES PROCESSORS 4) + endif() + if (${TEST} MATCHES "memory") + message(STATUS "Single threaded test: ${TESTNAME}") + set_tests_properties(${TESTNAME} PROPERTIES PROCESSORS 4) + endif() + endif() if (${TEST_CATEGORY} MATCHES "func") target_compile_definitions(${TESTNAME} PRIVATE -DUSE_SNMALLOC_STATS) endif () diff --git a/src/test/func/memory/memory.cc b/src/test/func/memory/memory.cc index 73f40f5..e238a3a 100644 --- a/src/test/func/memory/memory.cc +++ b/src/test/func/memory/memory.cc @@ -1,3 +1,4 @@ +#include #include #include #include @@ -215,11 +216,14 @@ void test_external_pointer_large() // Pre allocate all the objects size_t* objects[count]; + size_t total_size = 0; + for (size_t i = 0; i < count; i++) { size_t b = snmalloc::bits::is64() ? 28 : 26; size_t rand = r.next() & ((1 << b) - 1); size_t size = (1 << 24) + rand; + total_size += size; // store object objects[i] = (size_t*)alloc->alloc(size); // Store allocators size for this object @@ -235,6 +239,9 @@ void test_external_pointer_large() check_external_pointer_large(objects[i]); } + std::cout << "Total size allocated in test_external_pointer_large: " + << total_size << std::endl; + // Deallocate everything for (size_t i = 0; i < count; i++) {