1010#ifndef UMF_MEMORY_POOL_H
1111#define UMF_MEMORY_POOL_H 1
1212
13+ #include <stddef.h>
14+
1315#include <umf/base.h>
1416#include <umf/memory_pool_ops.h>
1517#include <umf/memory_provider.h>
@@ -105,9 +107,11 @@ void *umfPoolRealloc(umf_memory_pool_handle_t hPool, void *ptr, size_t size);
105107/// @brief Obtains size of block of memory allocated from the \p hPool for a given \p ptr
106108/// @param hPool specified memory hPool
107109/// @param ptr pointer to the allocated memory
108- /// @return size of the memory block allocated from the \p hPool
110+ /// @param size [out] pointer to a variable that will receive the size of the memory block
111+ /// @return UMF_RESULT_SUCCESS on success or appropriate error code on failure.
109112///
110- size_t umfPoolMallocUsableSize (umf_memory_pool_handle_t hPool , const void * ptr );
113+ umf_result_t umfPoolMallocUsableSize (umf_memory_pool_handle_t hPool ,
114+ const void * ptr , size_t * size );
111115
112116///
113117/// @brief Frees the memory space of the specified \p hPool pointed by \p ptr
@@ -152,14 +156,16 @@ umf_result_t umfPoolGetLastAllocationError(umf_memory_pool_handle_t hPool);
152156/// @brief Retrieve memory pool associated with a given ptr. Only memory allocated
153157/// with the usage of a memory provider is being tracked.
154158/// @param ptr pointer to memory belonging to a memory pool
155- /// @return Handle to a memory pool that contains ptr or NULL if pointer does not belong to any UMF pool.
159+ /// @param pool [out] handle to the memory pool that contains ptr
160+ /// @return UMF_RESULT_SUCCESS on success
161+ /// UMF_RESULT_ERROR_INVALID_ARGUMENT if pool is NULL, or ptr do not belongs to any pool.
156162///
157- umf_memory_pool_handle_t umfPoolByPtr (const void * ptr );
163+ umf_result_t umfPoolByPtr (const void * ptr , umf_memory_pool_handle_t * pool );
158164
159165///
160166/// @brief Retrieve memory provider associated with a given pool.
161167/// @param hPool specified memory pool
162- /// @param hProvider [out] memory providers handle.
168+ /// @param hProvider [out] memory providers handle
163169/// @return UMF_RESULT_SUCCESS on success or appropriate error code on failure.
164170/// UMF_RESULT_ERROR_INVALID_ARGUMENT if hProvider is NULL
165171///
@@ -169,10 +175,10 @@ umf_result_t umfPoolGetMemoryProvider(umf_memory_pool_handle_t hPool,
169175///
170176/// @brief Retrieve name of a given memory \p pool.
171177/// @param pool handle to the memory pool
172- /// @return pointer to a string containing the name of the \p pool
173- /// or NULL if the pool doesn't support retrieving its name .
178+ /// @param name [out] pointer to a string containing the name of the \p pool
179+ /// @return UMF_RESULT_SUCCESS on success or appropriate error code on failure .
174180///
175- const char * umfPoolGetName (umf_memory_pool_handle_t pool );
181+ umf_result_t umfPoolGetName (umf_memory_pool_handle_t pool , const char * * name );
176182
177183///
178184/// @brief Set a custom tag on the memory pool that can be later retrieved using umfPoolGetTag.
0 commit comments