Skip to content

Commit 74a9354

Browse files
committed
Fix trackingFree() for providers not supporting free() op
Fix trackingFree() for providers not supporting free() op: do not add memory back to the tracker, if the provider does not support the free() operation. Fixes: #864 Signed-off-by: Lukasz Dorau <[email protected]>
1 parent d39a1e5 commit 74a9354

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

src/provider/provider_tracking.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,12 @@ static umf_result_t trackingFree(void *hProvider, void *ptr, size_t size) {
382382
ret = umfMemoryProviderFree(p->hUpstream, ptr, size);
383383
if (ret != UMF_RESULT_SUCCESS) {
384384
LOG_ERR("upstream provider failed to free the memory");
385+
// Do not add memory back to the tracker,
386+
// if the provider does not support the free() op.
387+
if (ret == UMF_RESULT_ERROR_NOT_SUPPORTED) {
388+
return ret_remove;
389+
}
390+
385391
// Do not add memory back to the tracker,
386392
// if it had not been removed.
387393
if (ret_remove != UMF_RESULT_SUCCESS) {

test/provider_devdax_memory_ipc.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ static std::vector<ipcTestParams> getIpcProxyPoolTestParamsList(void) {
3939

4040
ipcProxyPoolTestParamsList = {
4141
{umfProxyPoolOps(), nullptr, umfDevDaxMemoryProviderOps(),
42-
&defaultDevDaxParams, &hostAccessor, true},
42+
&defaultDevDaxParams, &hostAccessor, false},
4343
#ifdef UMF_POOL_JEMALLOC_ENABLED
4444
{umfJemallocPoolOps(), nullptr, umfDevDaxMemoryProviderOps(),
4545
&defaultDevDaxParams, &hostAccessor, false},

test/provider_file_memory_ipc.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ HostMemoryAccessor hostAccessor;
3232
static std::vector<ipcTestParams> ipcManyPoolsTestParamsList = {
3333
// TODO: enable it when sizes of allocations in ipcFixtures.hpp are fixed
3434
// {umfProxyPoolOps(), nullptr, umfFileMemoryProviderOps(),
35-
// &file_params_shared, &hostAccessor, true},
35+
// &file_params_shared, &hostAccessor, false},
3636
#ifdef UMF_POOL_JEMALLOC_ENABLED
3737
{umfJemallocPoolOps(), nullptr, umfFileMemoryProviderOps(),
3838
&file_params_shared, &hostAccessor, false},

0 commit comments

Comments
 (0)