Skip to content

Add Jemalloc pool to mallocPoolTest suite #1459

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions test/memoryPoolAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
#include <umf/pools/pool_disjoint.h>
#include <umf/pools/pool_proxy.h>

#ifdef UMF_POOL_JEMALLOC_ENABLED
#include <umf/pools/pool_jemalloc.h>
#include <umf/providers/provider_os_memory.h>
#endif

#ifdef UMF_PROXY_LIB_ENABLED
#include <umf/proxy_lib_new_delete.h>
#endif
Expand Down Expand Up @@ -300,6 +305,31 @@ TEST_F(tagTest, SetAndGetInvalidPool) {
ASSERT_EQ(ret, UMF_RESULT_ERROR_INVALID_ARGUMENT);
}

#ifdef UMF_POOL_JEMALLOC_ENABLED
static void *createOsMemoryProviderParams() {
umf_os_memory_provider_params_handle_t params = nullptr;
umf_result_t res = umfOsMemoryProviderParamsCreate(&params);
if (res != UMF_RESULT_SUCCESS) {
throw std::runtime_error("Failed to create os memory provider params");
}

return params;
}

static umf_result_t destroyOsMemoryProviderParams(void *params) {
return umfOsMemoryProviderParamsDestroy(
(umf_os_memory_provider_params_handle_t)params);
}

INSTANTIATE_TEST_SUITE_P(
jemallocPoolTest, umfPoolTest,
::testing::Values(poolCreateExtParams{
umfJemallocPoolOps(), nullptr, nullptr, umfOsMemoryProviderOps(),
createOsMemoryProviderParams, destroyOsMemoryProviderParams}),
poolCreateExtParamsNameGen);

#endif /* UMF_POOL_JEMALLOC_ENABLED */

INSTANTIATE_TEST_SUITE_P(
mallocPoolTest, umfPoolTest,
::testing::Values(
Expand Down