Skip to content

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

Open
@KFilipek

Description

@KFilipek
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)

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions