@@ -36,14 +36,6 @@ umfJemallocPoolParamsDestroy(umf_jemalloc_pool_params_handle_t hParams) {
3636 return UMF_RESULT_ERROR_NOT_SUPPORTED ;
3737}
3838
39- umf_result_t
40- umfJemallocPoolParamsSetKeepAllMemory (umf_jemalloc_pool_params_handle_t hParams ,
41- bool keepAllMemory ) {
42- (void )hParams ; // unused
43- (void )keepAllMemory ; // unused
44- return UMF_RESULT_ERROR_NOT_SUPPORTED ;
45- }
46-
4739#else
4840
4941#include <jemalloc/jemalloc.h>
@@ -53,14 +45,11 @@ umfJemallocPoolParamsSetKeepAllMemory(umf_jemalloc_pool_params_handle_t hParams,
5345typedef struct jemalloc_memory_pool_t {
5446 umf_memory_provider_handle_t provider ;
5547 unsigned int arena_index ; // index of jemalloc arena
56- // set to true if umfMemoryProviderFree() should never be called
57- bool disable_provider_free ;
5848} jemalloc_memory_pool_t ;
5949
6050// Configuration of Jemalloc Pool
6151typedef struct umf_jemalloc_pool_params_t {
62- /// Set to true if umfMemoryProviderFree() should never be called.
63- bool disable_provider_free ;
52+ int placeholder ; // just a placeholder
6453} umf_jemalloc_pool_params_t ;
6554
6655static __TLS umf_result_t TLS_last_allocation_error ;
@@ -89,7 +78,7 @@ umfJemallocPoolParamsCreate(umf_jemalloc_pool_params_handle_t *hParams) {
8978 return UMF_RESULT_ERROR_OUT_OF_HOST_MEMORY ;
9079 }
9180
92- params_data -> disable_provider_free = false ;
81+ params_data -> placeholder = 1 ;
9382
9483 * hParams = (umf_jemalloc_pool_params_handle_t )params_data ;
9584
@@ -108,19 +97,6 @@ umfJemallocPoolParamsDestroy(umf_jemalloc_pool_params_handle_t hParams) {
10897 return UMF_RESULT_SUCCESS ;
10998}
11099
111- umf_result_t
112- umfJemallocPoolParamsSetKeepAllMemory (umf_jemalloc_pool_params_handle_t hParams ,
113- bool keepAllMemory ) {
114- if (!hParams ) {
115- LOG_ERR ("jemalloc pool params handle is NULL" );
116- return UMF_RESULT_ERROR_INVALID_ARGUMENT ;
117- }
118-
119- hParams -> disable_provider_free = keepAllMemory ;
120-
121- return UMF_RESULT_SUCCESS ;
122- }
123-
124100// arena_extent_alloc - an extent allocation function conforms to the extent_alloc_t type and upon
125101// success returns a pointer to size bytes of mapped memory on behalf of arena arena_ind such that
126102// the extent's base address is a multiple of alignment, as well as setting *zero to indicate
@@ -150,9 +126,7 @@ static void *arena_extent_alloc(extent_hooks_t *extent_hooks, void *new_addr,
150126 }
151127
152128 if (new_addr != NULL && ptr != new_addr ) {
153- if (!pool -> disable_provider_free ) {
154- umfMemoryProviderFree (pool -> provider , ptr , size );
155- }
129+ umfMemoryProviderFree (pool -> provider , ptr , size );
156130 return NULL ;
157131 }
158132
@@ -186,10 +160,6 @@ static void arena_extent_destroy(extent_hooks_t *extent_hooks, void *addr,
186160
187161 jemalloc_memory_pool_t * pool = get_pool_by_arena_index (arena_ind );
188162
189- if (pool -> disable_provider_free ) {
190- return ;
191- }
192-
193163 umf_result_t ret ;
194164 ret = umfMemoryProviderFree (pool -> provider , addr , size );
195165 if (ret != UMF_RESULT_SUCCESS ) {
@@ -212,10 +182,6 @@ static bool arena_extent_dalloc(extent_hooks_t *extent_hooks, void *addr,
212182
213183 jemalloc_memory_pool_t * pool = get_pool_by_arena_index (arena_ind );
214184
215- if (pool -> disable_provider_free ) {
216- return true; // opt-out from deallocation
217- }
218-
219185 umf_result_t ret ;
220186 ret = umfMemoryProviderFree (pool -> provider , addr , size );
221187 if (ret != UMF_RESULT_SUCCESS ) {
@@ -466,12 +432,10 @@ static void *op_aligned_alloc(void *pool, size_t size, size_t alignment) {
466432
467433static umf_result_t op_initialize (umf_memory_provider_handle_t provider ,
468434 void * params , void * * out_pool ) {
435+ (void )params ; // unused
469436 assert (provider );
470437 assert (out_pool );
471438
472- umf_jemalloc_pool_params_handle_t je_params =
473- (umf_jemalloc_pool_params_handle_t )params ;
474-
475439 extent_hooks_t * pHooks = & arena_extent_hooks ;
476440 size_t unsigned_size = sizeof (unsigned );
477441 int err ;
@@ -484,12 +448,6 @@ static umf_result_t op_initialize(umf_memory_provider_handle_t provider,
484448
485449 pool -> provider = provider ;
486450
487- if (je_params ) {
488- pool -> disable_provider_free = je_params -> disable_provider_free ;
489- } else {
490- pool -> disable_provider_free = false;
491- }
492-
493451 unsigned arena_index ;
494452 err = je_mallctl ("arenas.create" , (void * )& arena_index , & unsigned_size ,
495453 NULL , 0 );
0 commit comments