This is an autogenerated patch header for a single-debian-patch file. The
delta against upstream is either kept as a single patch, or maintained
in some VCS, and exported as a single patch instead of more manageable
atomic patches.

--- pmemkv-1.3.orig/tests/CMakeLists.txt
+++ pmemkv-1.3/tests/CMakeLists.txt
@@ -742,13 +742,13 @@ if(ENGINE_VCMAP)
 			BINARY concurrent_put_get_remove_single_op_params
 			TRACERS none # XXX - tbb lock does not work well with drd or helgrind
 			SCRIPT memkind_based/default.cmake
-			PARAMS 1000)
+			DB_SIZE "MIN_JEMALLOC_ARENA_SIZE" PARAMS 1000)
 
 	add_engine_test(ENGINE vcmap
 			BINARY concurrent_put_get_remove_single_op_params
 			TRACERS memcheck # XXX - tbb lock does not work well with drd or helgrind
 			SCRIPT memkind_based/default.cmake
-			PARAMS 400)
+			DB_SIZE "MIN_JEMALLOC_ARENA_SIZE" PARAMS 400)
 
 	add_engine_test(ENGINE vcmap
 			BINARY memkind_error_handling
--- pmemkv-1.3.orig/tests/ctest_helpers.cmake
+++ pmemkv-1.3/tests/ctest_helpers.cmake
@@ -304,6 +304,17 @@ function(add_engine_test)
 
 	if("${TEST_DB_SIZE}" STREQUAL "")
 		set(TEST_DB_SIZE 104857600) # 100MB
+	elseif("${TEST_DB_SIZE}" STREQUAL "MIN_JEMALLOC_ARENA_SIZE")
+		execute_process(COMMAND nproc OUTPUT_VARIABLE NPROC)
+		#By default jemalloc creates 4 arenas for each logical CPU with 2MB chunks
+		math(EXPR TEST_DB_SIZE "${NPROC} * 4 * 2 * 1024 * 1024")
+
+		#Limit size DB_SIZE with arbitrary chosen threshold
+		math(EXPR TEST_DB_SIZE_THRESHOLD "256 * 4 * 2 * 1024 * 1024")
+		if(TEST_DB_SIZE GREATER ${TEST_DB_SIZE_THRESHOLD})
+			message(WARNING "Calculated TEST_DB_SIZE reached threshold: ${TEST_DB_SIZE_THRESHOLD}. This may cause failures in some tests of memkind based engines.")
+			set(TEST_DB_SIZE ${TEST_DB_SIZE_THRESHOLD})
+		endif()
 	endif()
 
 	get_filename_component(script_name ${cmake_script} NAME)
