Skip to content

Commit 6028d1b

Browse files
committed
Add Jemalloc pool to mallocPoolTest suite
Add Jemalloc pool to mallocPoolTest suite. Fixes: #1455 Signed-off-by: Lukasz Dorau <[email protected]>
1 parent 3c015d4 commit 6028d1b

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

test/memoryPoolAPI.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212

1313
#include <umf/memory_provider.h>
1414
#include <umf/pools/pool_disjoint.h>
15+
#include <umf/pools/pool_jemalloc.h>
1516
#include <umf/pools/pool_proxy.h>
17+
#include <umf/providers/provider_os_memory.h>
1618

1719
#ifdef UMF_PROXY_LIB_ENABLED
1820
#include <umf/proxy_lib_new_delete.h>
@@ -300,13 +302,31 @@ TEST_F(tagTest, SetAndGetInvalidPool) {
300302
ASSERT_EQ(ret, UMF_RESULT_ERROR_INVALID_ARGUMENT);
301303
}
302304

305+
static void *createOsMemoryProviderParams() {
306+
umf_os_memory_provider_params_handle_t params = nullptr;
307+
umf_result_t res = umfOsMemoryProviderParamsCreate(&params);
308+
if (res != UMF_RESULT_SUCCESS) {
309+
throw std::runtime_error("Failed to create os memory provider params");
310+
}
311+
312+
return params;
313+
}
314+
315+
static umf_result_t destroyOsMemoryProviderParams(void *params) {
316+
return umfOsMemoryProviderParamsDestroy(
317+
(umf_os_memory_provider_params_handle_t)params);
318+
}
319+
303320
INSTANTIATE_TEST_SUITE_P(
304321
mallocPoolTest, umfPoolTest,
305322
::testing::Values(
306323
poolCreateExtParams{&MALLOC_POOL_OPS, nullptr, nullptr,
307324
&UMF_NULL_PROVIDER_OPS, nullptr, nullptr},
308325
poolCreateExtParams{umfProxyPoolOps(), nullptr, nullptr,
309326
&BA_GLOBAL_PROVIDER_OPS, nullptr, nullptr},
327+
poolCreateExtParams{
328+
umfJemallocPoolOps(), nullptr, nullptr, umfOsMemoryProviderOps(),
329+
createOsMemoryProviderParams, destroyOsMemoryProviderParams},
310330
poolCreateExtParams{umfDisjointPoolOps(), defaultDisjointPoolConfig,
311331
defaultDisjointPoolConfigDestroy,
312332
&BA_GLOBAL_PROVIDER_OPS, nullptr, nullptr}),

0 commit comments

Comments
 (0)