oneapi-src / oneapi-src/unified-memory-framework

[disjoint] allocation causes log error on free on default slab_min_size

Open
#1,351 0 comments 0 reactions 1 assignee View on GitHub

@KFilipek is already working on this.

Since Jun 3, 2025.

bug
Dominant language
C
Stars
98
Forks
48
Avg merge
3d 20h
Merged PRs (30d)
6

Description

umf_os_memory_provider_params_handle_t os_memory_provider_params = nullptr;
umfOsMemoryProviderParamsCreate(&os_memory_provider_params);
umf_memory_provider_handle_t provider_handle;
umfMemoryProviderCreate(umfOsMemoryProviderOps(), os_memory_provider_params, provider_handle);

umf_disjoint_pool_params_handle_t params = nullptr;
ASSERT_SUCCESS(umfDisjointPoolParamsCreate(&params));

// Set max poolable size to a reasonable value
ASSERT_SUCCESS(umfDisjointPoolParamsSetMaxPoolableSize(params, 1024 * 1024));

// Set the trace level to 3 to enable allocation balance tracking
ASSERT_SUCCESS(umfDisjointPoolParamsSetTrace(params, 3));

umf_memory_pool_handle_t m_pool;
umfPoolCreate(umfDisjointPoolOps(), provider_handle, params, 0, &m_pool)

auto ptr = umfPoolMalloc(m_pool, 64); // Correct, increases bucket->alloc_count
umfPoolFree(m_pool, ptr); // Here is the problem, starts "regular free" because ptr == slab_get_end(slab)

Also logger returns such message:

[ERROR UMF] umfMemoryTrackerRemove: pointer 0x7d4cdc6cf000 not found in the alloc_segments_map
[ERROR UMF] trackingFree: failed to remove the region from the tracker, ptr=0x7d4cdc6cf000, size=64, ret = 2147483646

After all bucket->alloc_count is more than 0, but bucket->free_count is still 0.

Environment Information

  • UMF version (hash commit or a tag):
  • OS(es) version(s):
  • kernel version(s):
  • compiler, libraries, and other related tools version(s):

Please provide a reproduction of the bug:

How often bug is revealed:

(always, often, rare)

Actual behavior:

Expected behavior:

Details

Additional information about Priority and Help Requested:

Are you willing to submit a pull request with a proposed change? (Yes, No)

Requested priority: (Showstopper, High, Medium, Low)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.