Skip to content

Commit 6a18771

Browse files
committed
Replace linear base allocator with the fixed-size in the tracker
Replace linear base allocator with the fixed-size in trackingInitialize() and trackingFinalize(). Signed-off-by: Lukasz Dorau <[email protected]>
1 parent 5de8d28 commit 6a18771

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/provider/provider_tracking.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
*/
99

1010
#include "provider_tracking.h"
11+
#include "base_alloc_global.h"
1112
#include "critnib.h"
1213
#include "utils_concurrency.h"
1314

@@ -325,11 +326,9 @@ static umf_result_t trackingFree(void *hProvider, void *ptr, size_t size) {
325326
}
326327

327328
static umf_result_t trackingInitialize(void *params, void **ret) {
328-
umf_tracking_memory_provider_t *p =
329-
(umf_tracking_memory_provider_t *)params;
330329
umf_tracking_memory_provider_t *provider =
331-
(umf_tracking_memory_provider_t *)umf_ba_linear_alloc(
332-
p->hTracker->pool_linear, sizeof(umf_tracking_memory_provider_t));
330+
(umf_tracking_memory_provider_t *)umf_ba_global_alloc(
331+
sizeof(umf_tracking_memory_provider_t));
333332
if (!provider) {
334333
return UMF_RESULT_ERROR_OUT_OF_HOST_MEMORY;
335334
}
@@ -381,10 +380,7 @@ static void trackingFinalize(void *provider) {
381380
check_if_tracker_is_empty(p->hTracker, p->pool);
382381
#endif /* NDEBUG */
383382

384-
(void)provider; // unused in Release build
385-
// provider was allocated from the linear allocator,
386-
// so it will be freed, when the linear allocator is destroyed
387-
// in umfMemoryTrackerDestroy()
383+
umf_ba_global_free(provider, sizeof(umf_tracking_memory_provider_t));
388384
}
389385

390386
static void trackingGetLastError(void *provider, const char **msg,

0 commit comments

Comments
 (0)