summaryrefslogtreecommitdiff
path: root/src/lib/eina/eina_mempool.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/eina/eina_mempool.h')
-rw-r--r--src/lib/eina/eina_mempool.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/lib/eina/eina_mempool.h b/src/lib/eina/eina_mempool.h
index d7759ce..9b845c6 100644
--- a/src/lib/eina/eina_mempool.h
+++ b/src/lib/eina/eina_mempool.h
@@ -125,6 +125,29 @@ static inline void *eina_mempool_realloc(Eina_Mempool *mp, void *element, unsign
125static inline void *eina_mempool_malloc(Eina_Mempool *mp, unsigned int size) EINA_MALLOC EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT; 125static inline void *eina_mempool_malloc(Eina_Mempool *mp, unsigned int size) EINA_MALLOC EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT;
126 126
127/** 127/**
128 * @brief Allocates memory in the given mempool using locality hint to improve future memory access use.
129 *
130 * @param[in] mp The mempool
131 * @param[in] after Hint to the nearest pointer after which to try find an empty spot.
132 * @param[in] before Hint to the nearest pointer before which to try find an empty spot.
133 * @param[in] size The size in bytes to allocate
134 * @return The newly allocated data that might be near @p after and @p before.
135 *
136 * This function is to be used to improve cache locality of structure that are likely to be used
137 * one after another. An example of this use would be Eina_List.
138 *
139 * @note This function allocates and returns @p size bytes using the mempool @p mp.
140 * If not used anymore, the data must be freed with eina_mempool_free().
141 * @note @p after and @p before must be either @c NULL or allocated by the same mempool
142 * @p mp. They are hint and if no space near them is found, memory will be allocated
143 * without locality improvement.
144 * @warning No checks are done for @p mp.
145 *
146 * @see eina_mempool_free()
147 */
148static inline void *eina_mempool_malloc_near(Eina_Mempool *mp, void *after, void *before, unsigned int size) EINA_WARN_UNUSED_RESULT;
149
150/**
128 * @brief Allocates and zeros memory using the given mempool. 151 * @brief Allocates and zeros memory using the given mempool.
129 * 152 *
130 * @param[in] mp The mempool 153 * @param[in] mp The mempool