@@ -128,13 +128,6 @@ static umf_memory_pool_handle_t Proxy_pool = NULL;
128128// it protects us from recursion in umfPool*()
129129static __TLS int was_called_from_umfPool = 0 ;
130130
131- // This WA for the issue:
132- // https://github.com/oneapi-src/unified-memory-framework/issues/894
133- // It protects us from a recursion in malloc_usable_size()
134- // when the JEMALLOC proxy_lib_pool is used.
135- // TODO remove this WA when the issue is fixed.
136- static __TLS int was_called_from_malloc_usable_size = 0 ;
137-
138131/*****************************************************************************/
139132/*** The constructor and destructor of the proxy library *********************/
140133/*****************************************************************************/
@@ -478,18 +471,15 @@ size_t malloc_usable_size(void *ptr) {
478471 return 0 ; // unsupported in case of the ba_leak allocator
479472 }
480473
481- if (!was_called_from_malloc_usable_size && Proxy_pool &&
482- (umfPoolByPtr (ptr ) == Proxy_pool )) {
483- was_called_from_malloc_usable_size = 1 ;
474+ if (Proxy_pool && (umfPoolByPtr (ptr ) == Proxy_pool )) {
484475 was_called_from_umfPool = 1 ;
485476 size_t size = umfPoolMallocUsableSize (Proxy_pool , ptr );
486477 was_called_from_umfPool = 0 ;
487- was_called_from_malloc_usable_size = 0 ;
488478 return size ;
489479 }
490480
491481#ifndef _WIN32
492- if (! was_called_from_malloc_usable_size && Size_threshold_value ) {
482+ if (Size_threshold_value ) {
493483 return System_malloc_usable_size (ptr );
494484 }
495485#endif /* _WIN32 */
0 commit comments