1111using umf_test::test;
1212using namespace umf_test ;
1313
14- using os_params_unique_handle_t =
15- std::unique_ptr<umf_os_memory_provider_params_t ,
16- decltype (&umfOsMemoryProviderParamsDestroy)>;
14+ using void_unique_ptr = std::unique_ptr<void , decltype (&free)>;
1715
1816void *createOsMemoryProviderParams () {
1917 umf_os_memory_provider_params_handle_t params = nullptr ;
@@ -30,11 +28,43 @@ umf_result_t destroyOsMemoryProviderParams(void *params) {
3028 (umf_os_memory_provider_params_handle_t )params);
3129}
3230
31+ void *createFixedMemoryProviderParams () {
32+ // Allocate a memory buffer to use with the fixed memory provider.
33+ // The umfPoolTest.malloc_compliance test requires a lot of memory.
34+ size_t memory_size = (1UL << 31 );
35+ static void_unique_ptr memory_buffer =
36+ void_unique_ptr (malloc (memory_size), free);
37+ if (memory_buffer.get () == NULL ) {
38+ throw std::runtime_error (
39+ " Failed to allocate memory for Fixed memory provider" );
40+ }
41+
42+ umf_fixed_memory_provider_params_handle_t params = nullptr ;
43+ umf_result_t res = umfFixedMemoryProviderParamsCreate (
44+ ¶ms, memory_buffer.get (), memory_size);
45+ if (res != UMF_RESULT_SUCCESS) {
46+ throw std::runtime_error (
47+ " Failed to create Fixed memory provider params" );
48+ }
49+
50+ return params;
51+ }
52+
53+ umf_result_t destroyFixedMemoryProviderParams (void *params) {
54+ return umfFixedMemoryProviderParamsDestroy (
55+ (umf_fixed_memory_provider_params_handle_t )params);
56+ }
57+
3358INSTANTIATE_TEST_SUITE_P (
3459 jemallocPoolTest, umfPoolTest,
35- ::testing::Values (poolCreateExtParams{
36- umfJemallocPoolOps (), nullptr , nullptr , umfOsMemoryProviderOps (),
37- createOsMemoryProviderParams, destroyOsMemoryProviderParams}));
60+ ::testing::Values (poolCreateExtParams{umfJemallocPoolOps (), nullptr ,
61+ nullptr , umfOsMemoryProviderOps (),
62+ createOsMemoryProviderParams,
63+ destroyOsMemoryProviderParams},
64+ poolCreateExtParams{umfJemallocPoolOps (), nullptr ,
65+ nullptr , umfFixedMemoryProviderOps (),
66+ createFixedMemoryProviderParams,
67+ destroyFixedMemoryProviderParams}));
3868
3969// this test makes sure that jemalloc does not use
4070// memory provider to allocate metadata (and hence
0 commit comments