\hypertarget{group__Eina__Memory__Pool__Group}{}\doxysection{Memory Pool}
\label{group__Eina__Memory__Pool__Group}\index{Memory Pool@{Memory Pool}}


This group discusses the functions that provide memory pool management.  


\doxysubsection*{Typedefs}
\begin{DoxyCompactItemize}
\item 
\mbox{\Hypertarget{group__Eina__Memory__Pool__Group_ga8ca45185c6759c6c7b57e7c1b614215a}\label{group__Eina__Memory__Pool__Group_ga8ca45185c6759c6c7b57e7c1b614215a}} 
typedef struct \mbox{\hyperlink{struct__Eina__Mempool}{\+\_\+\+Eina\+\_\+\+Mempool}} {\bfseries Eina\+\_\+\+Mempool}
\begin{DoxyCompactList}\small\item\em The opaque type for the mempool structure. \end{DoxyCompactList}\item 
\mbox{\Hypertarget{group__Eina__Memory__Pool__Group_gaad1bbde75fe98f5cff269c0411678ff9}\label{group__Eina__Memory__Pool__Group_gaad1bbde75fe98f5cff269c0411678ff9}} 
typedef struct \mbox{\hyperlink{struct__Eina__Mempool__Backend}{\+\_\+\+Eina\+\_\+\+Mempool\+\_\+\+Backend}} {\bfseries Eina\+\_\+\+Mempool\+\_\+\+Backend}
\begin{DoxyCompactList}\small\item\em The opaque type for the mempool backend type. \end{DoxyCompactList}\item 
typedef void($\ast$ \mbox{\hyperlink{group__Eina__Memory__Pool__Group_ga36987f282791adfc0d82c493af4462dc}{Eina\+\_\+\+Mempool\+\_\+\+Repack\+\_\+\+Cb}}) (void $\ast$dst, void $\ast$src, void $\ast$data)
\begin{DoxyCompactList}\small\item\em The callback type which is called when the mempool \char`\"{}repacks\char`\"{} its data. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
\mbox{\hyperlink{group__Eina__Types__Group_ga6ac08753ba12bc9c7a0390cf67868f4f}{EINA\+\_\+\+API}} \mbox{\hyperlink{group__Eina__Memory__Pool__Group_ga8ca45185c6759c6c7b57e7c1b614215a}{Eina\+\_\+\+Mempool}} $\ast$ \mbox{\hyperlink{group__Eina__Memory__Pool__Group_ga2b67a4285f612a2ed4767177f865f095}{eina\+\_\+mempool\+\_\+add}} (const char $\ast$name, const char $\ast$context, const char $\ast$options,...)
\begin{DoxyCompactList}\small\item\em Creates a new mempool of the given type. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__Eina__Types__Group_ga6ac08753ba12bc9c7a0390cf67868f4f}{EINA\+\_\+\+API}} void \mbox{\hyperlink{group__Eina__Memory__Pool__Group_gaca341af7df37485e3d8ed42e011b2aab}{eina\+\_\+mempool\+\_\+del}} (\mbox{\hyperlink{group__Eina__Memory__Pool__Group_ga8ca45185c6759c6c7b57e7c1b614215a}{Eina\+\_\+\+Mempool}} $\ast$mp)
\begin{DoxyCompactList}\small\item\em Deletes the given mempool. \end{DoxyCompactList}\item 
static void $\ast$ \mbox{\hyperlink{group__Eina__Memory__Pool__Group_ga90b737a5553eb7ed7fe91af1c8127132}{eina\+\_\+mempool\+\_\+realloc}} (\mbox{\hyperlink{group__Eina__Memory__Pool__Group_ga8ca45185c6759c6c7b57e7c1b614215a}{Eina\+\_\+\+Mempool}} $\ast$mp, void $\ast$element, unsigned int size)
\begin{DoxyCompactList}\small\item\em Re-\/allocates an amount memory by the given mempool. \end{DoxyCompactList}\item 
static void $\ast$ \mbox{\hyperlink{group__Eina__Memory__Pool__Group_ga2518cc9ac3b8f0e8947e208e309503b9}{eina\+\_\+mempool\+\_\+malloc}} (\mbox{\hyperlink{group__Eina__Memory__Pool__Group_ga8ca45185c6759c6c7b57e7c1b614215a}{Eina\+\_\+\+Mempool}} $\ast$mp, unsigned int size)
\begin{DoxyCompactList}\small\item\em Allocates memory using the given mempool. \end{DoxyCompactList}\item 
static void $\ast$ \mbox{\hyperlink{group__Eina__Memory__Pool__Group_ga6099d5613e58b42be2aebfbff5c10604}{eina\+\_\+mempool\+\_\+malloc\+\_\+near}} (\mbox{\hyperlink{group__Eina__Memory__Pool__Group_ga8ca45185c6759c6c7b57e7c1b614215a}{Eina\+\_\+\+Mempool}} $\ast$mp, void $\ast$after, void $\ast$before, unsigned int size)
\begin{DoxyCompactList}\small\item\em Allocates memory in the given mempool using locality hint to improve future memory access use. \end{DoxyCompactList}\item 
static void $\ast$ \mbox{\hyperlink{group__Eina__Memory__Pool__Group_ga224fe9097f28eb89da102ceb942b5c9b}{eina\+\_\+mempool\+\_\+calloc}} (\mbox{\hyperlink{group__Eina__Memory__Pool__Group_ga8ca45185c6759c6c7b57e7c1b614215a}{Eina\+\_\+\+Mempool}} $\ast$mp, unsigned int size)
\begin{DoxyCompactList}\small\item\em Allocates and zeros memory using the given mempool. \end{DoxyCompactList}\item 
static void \mbox{\hyperlink{group__Eina__Memory__Pool__Group_gab863371d668381f7bca07d6fafcc2fc2}{eina\+\_\+mempool\+\_\+free}} (\mbox{\hyperlink{group__Eina__Memory__Pool__Group_ga8ca45185c6759c6c7b57e7c1b614215a}{Eina\+\_\+\+Mempool}} $\ast$mp, void $\ast$element)
\begin{DoxyCompactList}\small\item\em Frees resources previously allocated by the given mempool. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__Eina__Types__Group_ga6ac08753ba12bc9c7a0390cf67868f4f}{EINA\+\_\+\+API}} void \mbox{\hyperlink{group__Eina__Memory__Pool__Group_gad90b9562051aa98f5e89689c1064c22e}{eina\+\_\+mempool\+\_\+repack}} (\mbox{\hyperlink{group__Eina__Memory__Pool__Group_ga8ca45185c6759c6c7b57e7c1b614215a}{Eina\+\_\+\+Mempool}} $\ast$mp, \mbox{\hyperlink{group__Eina__Memory__Pool__Group_ga36987f282791adfc0d82c493af4462dc}{Eina\+\_\+\+Mempool\+\_\+\+Repack\+\_\+\+Cb}} cb, void $\ast$data)
\begin{DoxyCompactList}\small\item\em Repacks the objects in the mempool. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__Eina__Types__Group_ga6ac08753ba12bc9c7a0390cf67868f4f}{EINA\+\_\+\+API}} void \mbox{\hyperlink{group__Eina__Memory__Pool__Group_ga95cabe35226f60ce2e22aea1df0087ca}{eina\+\_\+mempool\+\_\+gc}} (\mbox{\hyperlink{group__Eina__Memory__Pool__Group_ga8ca45185c6759c6c7b57e7c1b614215a}{Eina\+\_\+\+Mempool}} $\ast$mp)
\begin{DoxyCompactList}\small\item\em Runs a garbage collection cycle. \end{DoxyCompactList}\item 
static \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\+\_\+\+Bool}} \mbox{\hyperlink{group__Eina__Memory__Pool__Group_ga3b619cca8ce4a3cb35ca93907f5be0d3}{eina\+\_\+mempool\+\_\+from}} (\mbox{\hyperlink{group__Eina__Memory__Pool__Group_ga8ca45185c6759c6c7b57e7c1b614215a}{Eina\+\_\+\+Mempool}} $\ast$mp, void $\ast$element)
\begin{DoxyCompactList}\small\item\em Check if a pointer is a valid element from the mempool. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__Eina__Types__Group_ga6ac08753ba12bc9c7a0390cf67868f4f}{EINA\+\_\+\+API}} void \mbox{\hyperlink{group__Eina__Memory__Pool__Group_ga83214b1782a47f139aa31224faccae96}{eina\+\_\+mempool\+\_\+statistics}} (\mbox{\hyperlink{group__Eina__Memory__Pool__Group_ga8ca45185c6759c6c7b57e7c1b614215a}{Eina\+\_\+\+Mempool}} $\ast$mp)
\begin{DoxyCompactList}\small\item\em Has the backend update its internal statistics. \end{DoxyCompactList}\item 
static \mbox{\hyperlink{group__Eina__Iterator__Group_ga15b975bb881d955249ce13d4ebc96948}{Eina\+\_\+\+Iterator}} $\ast$ \mbox{\hyperlink{group__Eina__Memory__Pool__Group_ga252ed0556dfb25d068ac30fd0dbe9653}{eina\+\_\+mempool\+\_\+iterator\+\_\+new}} (\mbox{\hyperlink{group__Eina__Memory__Pool__Group_ga8ca45185c6759c6c7b57e7c1b614215a}{Eina\+\_\+\+Mempool}} $\ast$mp)
\begin{DoxyCompactList}\small\item\em Provide an iterator to walk all allocated elements from a specified mempool. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__Eina__Types__Group_ga6ac08753ba12bc9c7a0390cf67868f4f}{EINA\+\_\+\+API}} \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\+\_\+\+Bool}} \mbox{\hyperlink{group__Eina__Memory__Pool__Group_ga644320f3f3146c8e0512ea7e0acacf76}{eina\+\_\+mempool\+\_\+register}} (\mbox{\hyperlink{group__Eina__Memory__Pool__Group_gaad1bbde75fe98f5cff269c0411678ff9}{Eina\+\_\+\+Mempool\+\_\+\+Backend}} $\ast$be)
\begin{DoxyCompactList}\small\item\em Registers the given memory pool backend. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__Eina__Types__Group_ga6ac08753ba12bc9c7a0390cf67868f4f}{EINA\+\_\+\+API}} void \mbox{\hyperlink{group__Eina__Memory__Pool__Group_gaa4955a8c3af9a4da532d05d8be132848}{eina\+\_\+mempool\+\_\+unregister}} (\mbox{\hyperlink{group__Eina__Memory__Pool__Group_gaad1bbde75fe98f5cff269c0411678ff9}{Eina\+\_\+\+Mempool\+\_\+\+Backend}} $\ast$be)
\begin{DoxyCompactList}\small\item\em Unregisters the given memory pool backend. \end{DoxyCompactList}\item 
static unsigned int \mbox{\hyperlink{group__Eina__Memory__Pool__Group_gaf91146872014f8a8df3abe29b83356fe}{eina\+\_\+mempool\+\_\+alignof}} (unsigned int size)
\begin{DoxyCompactList}\small\item\em Computes the alignment that would be used when allocating a object of size {\ttfamily size}. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Variables}
\begin{DoxyCompactItemize}
\item 
\mbox{\Hypertarget{group__Eina__Memory__Pool__Group_gacb7882aa0f0813fa63e3be58595007bf}\label{group__Eina__Memory__Pool__Group_gacb7882aa0f0813fa63e3be58595007bf}} 
\mbox{\hyperlink{group__Eina__Types__Group_ga6ac08753ba12bc9c7a0390cf67868f4f}{EINA\+\_\+\+API}} \mbox{\hyperlink{group__Eina__Error__Group_ga95b3cbb33e987e7d92a81ea785001686}{Eina\+\_\+\+Error}} {\bfseries EINA\+\_\+\+ERROR\+\_\+\+NOT\+\_\+\+MEMPOOL\+\_\+\+MODULE}
\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
This group discusses the functions that provide memory pool management. 

Several mempools are available\+:

\begin{DoxyItemize}
\item {\ttfamily chained\+\_\+pool\+:} It is the default one. It allocates a big chunk of memory with malloc() and splits the result into chunks of the requested size that are pushed inside a stack. When requested, it takes this pointer from the stack to give them to whoever wants them. \item {\ttfamily pass\+\_\+through\+:} it just call malloc() and free(). It may be faster on some computers than using our own allocators (like having a huge L2 cache, over 4MB). \item {\ttfamily one\+\_\+big\+:} It calls malloc() just one time for the requested number of items. This is useful when you know in advance how many objects of some type live during the life of the mempool. \end{DoxyItemize}


\doxysubsection{Typedef Documentation}
\mbox{\Hypertarget{group__Eina__Memory__Pool__Group_ga36987f282791adfc0d82c493af4462dc}\label{group__Eina__Memory__Pool__Group_ga36987f282791adfc0d82c493af4462dc}} 
\index{Memory Pool@{Memory Pool}!Eina\_Mempool\_Repack\_Cb@{Eina\_Mempool\_Repack\_Cb}}
\index{Eina\_Mempool\_Repack\_Cb@{Eina\_Mempool\_Repack\_Cb}!Memory Pool@{Memory Pool}}
\doxysubsubsection{\texorpdfstring{Eina\_Mempool\_Repack\_Cb}{Eina\_Mempool\_Repack\_Cb}}
{\footnotesize\ttfamily Eina\+\_\+\+Mempool\+\_\+\+Repack\+\_\+\+Cb}



The callback type which is called when the mempool \char`\"{}repacks\char`\"{} its data. 

I.\+e. moves it around to optimize the way it is stored in memory. This is useful to improve data locality and to free internal pools back to the OS.

\begin{DoxyNote}{Note}
The callback needs to update users of the data to stop accessing the object from the old location and access it using the new location instead. The copy of memory is taken care of by the mempool. 
\end{DoxyNote}


\doxysubsection{Function Documentation}
\mbox{\Hypertarget{group__Eina__Memory__Pool__Group_ga2b67a4285f612a2ed4767177f865f095}\label{group__Eina__Memory__Pool__Group_ga2b67a4285f612a2ed4767177f865f095}} 
\index{Memory Pool@{Memory Pool}!eina\_mempool\_add@{eina\_mempool\_add}}
\index{eina\_mempool\_add@{eina\_mempool\_add}!Memory Pool@{Memory Pool}}
\doxysubsubsection{\texorpdfstring{eina\_mempool\_add()}{eina\_mempool\_add()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__Eina__Types__Group_ga6ac08753ba12bc9c7a0390cf67868f4f}{EINA\+\_\+\+API}} \mbox{\hyperlink{group__Eina__Memory__Pool__Group_ga8ca45185c6759c6c7b57e7c1b614215a}{Eina\+\_\+\+Mempool}} $\ast$ eina\+\_\+mempool\+\_\+add (\begin{DoxyParamCaption}\item[{const char $\ast$}]{name,  }\item[{const char $\ast$}]{context,  }\item[{const char $\ast$}]{options,  }\item[{}]{... }\end{DoxyParamCaption})}



Creates a new mempool of the given type. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em name} & Name of the mempool kind to use. \\
\hline
\mbox{\texttt{ in}}  & {\em context} & Identifier of the mempool created (for debug purposes). \\
\hline
\mbox{\texttt{ in}}  & {\em options} & Unused. Use the variable arguments list instead to pass options to the mempool. \\
\hline
\mbox{\texttt{ in}}  & {\em ...} & Additional options to pass to the allocator; depends entirely on the type of mempool (\char`\"{}int pool size\char`\"{} for chained and \char`\"{}int item\+\_\+size\char`\"{} for one\+\_\+big. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Newly allocated mempool instance, NULL otherwise. 
\end{DoxyReturn}


References \mbox{\hyperlink{group__Eina__Safety__Checks__Group_gab2b07061fc6500dedd9cd41c8d16f95d}{EINA\+\_\+\+SAFETY\+\_\+\+ON\+\_\+\+NULL\+\_\+\+RETURN\+\_\+\+VAL}}.



Referenced by \mbox{\hyperlink{group__Edje__General__Group_ga1c9c6594f38023c29fbfb2d0c8c675db}{edje\+\_\+init()}}, and \mbox{\hyperlink{group__Eina__Cow__Group_ga0c55f4406fbf96dca46de08719413153}{eina\+\_\+cow\+\_\+add()}}.

\mbox{\Hypertarget{group__Eina__Memory__Pool__Group_gaca341af7df37485e3d8ed42e011b2aab}\label{group__Eina__Memory__Pool__Group_gaca341af7df37485e3d8ed42e011b2aab}} 
\index{Memory Pool@{Memory Pool}!eina\_mempool\_del@{eina\_mempool\_del}}
\index{eina\_mempool\_del@{eina\_mempool\_del}!Memory Pool@{Memory Pool}}
\doxysubsubsection{\texorpdfstring{eina\_mempool\_del()}{eina\_mempool\_del()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__Eina__Types__Group_ga6ac08753ba12bc9c7a0390cf67868f4f}{EINA\+\_\+\+API}} void eina\+\_\+mempool\+\_\+del (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__Eina__Memory__Pool__Group_ga8ca45185c6759c6c7b57e7c1b614215a}{Eina\+\_\+\+Mempool}} $\ast$}]{mp }\end{DoxyParamCaption})}



Deletes the given mempool. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em mp} & The mempool to delete \\
\hline
\end{DoxyParams}


References \mbox{\hyperlink{group__Eina__Safety__Checks__Group_ga1ccf8538d0015b3801ff642e6156843a}{EINA\+\_\+\+SAFETY\+\_\+\+ON\+\_\+\+NULL\+\_\+\+RETURN}}.



Referenced by \mbox{\hyperlink{group__Edje__General__Group_ga1c9c6594f38023c29fbfb2d0c8c675db}{edje\+\_\+init()}}, and \mbox{\hyperlink{group__Eina__Cow__Group_gad03c0e15e2c7c9f539e3d3331cb74570}{eina\+\_\+cow\+\_\+del()}}.

\mbox{\Hypertarget{group__Eina__Memory__Pool__Group_ga90b737a5553eb7ed7fe91af1c8127132}\label{group__Eina__Memory__Pool__Group_ga90b737a5553eb7ed7fe91af1c8127132}} 
\index{Memory Pool@{Memory Pool}!eina\_mempool\_realloc@{eina\_mempool\_realloc}}
\index{eina\_mempool\_realloc@{eina\_mempool\_realloc}!Memory Pool@{Memory Pool}}
\doxysubsubsection{\texorpdfstring{eina\_mempool\_realloc()}{eina\_mempool\_realloc()}}
{\footnotesize\ttfamily static void $\ast$ eina\+\_\+mempool\+\_\+realloc (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__Eina__Memory__Pool__Group_ga8ca45185c6759c6c7b57e7c1b614215a}{Eina\+\_\+\+Mempool}} $\ast$}]{mp,  }\item[{void $\ast$}]{element,  }\item[{unsigned int}]{size }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



Re-\/allocates an amount memory by the given mempool. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em mp} & The mempool \\
\hline
\mbox{\texttt{ in}}  & {\em element} & The element to re-\/allocate \\
\hline
\mbox{\texttt{ in}}  & {\em size} & The size in bytes to re-\/allocate \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The newly re-\/allocated data
\end{DoxyReturn}
\begin{DoxyNote}{Note}
This function re-\/allocates and returns {\ttfamily element} with {\ttfamily size} bytes using the mempool {\ttfamily mp}. If not used anymore, the data must be freed with \mbox{\hyperlink{group__Eina__Memory__Pool__Group_gab863371d668381f7bca07d6fafcc2fc2}{eina\+\_\+mempool\+\_\+free()}}. 
\end{DoxyNote}
\begin{DoxyWarning}{Warning}
No checks are done for {\ttfamily mp}.
\end{DoxyWarning}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{group__Eina__Memory__Pool__Group_gab863371d668381f7bca07d6fafcc2fc2}{eina\+\_\+mempool\+\_\+free()}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{group__Eina__Memory__Pool__Group_ga2518cc9ac3b8f0e8947e208e309503b9}\label{group__Eina__Memory__Pool__Group_ga2518cc9ac3b8f0e8947e208e309503b9}} 
\index{Memory Pool@{Memory Pool}!eina\_mempool\_malloc@{eina\_mempool\_malloc}}
\index{eina\_mempool\_malloc@{eina\_mempool\_malloc}!Memory Pool@{Memory Pool}}
\doxysubsubsection{\texorpdfstring{eina\_mempool\_malloc()}{eina\_mempool\_malloc()}}
{\footnotesize\ttfamily static void $\ast$ eina\+\_\+mempool\+\_\+malloc (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__Eina__Memory__Pool__Group_ga8ca45185c6759c6c7b57e7c1b614215a}{Eina\+\_\+\+Mempool}} $\ast$}]{mp,  }\item[{unsigned int}]{size }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



Allocates memory using the given mempool. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em mp} & The mempool \\
\hline
\mbox{\texttt{ in}}  & {\em size} & The size in bytes to allocate \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The newly allocated data
\end{DoxyReturn}
\begin{DoxyNote}{Note}
This function allocates and returns {\ttfamily size} bytes using the mempool {\ttfamily mp}. If not used anymore, the data must be freed with \mbox{\hyperlink{group__Eina__Memory__Pool__Group_gab863371d668381f7bca07d6fafcc2fc2}{eina\+\_\+mempool\+\_\+free()}}. 
\end{DoxyNote}
\begin{DoxyWarning}{Warning}
No checks are done for {\ttfamily mp}.
\end{DoxyWarning}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{group__Eina__Memory__Pool__Group_gab863371d668381f7bca07d6fafcc2fc2}{eina\+\_\+mempool\+\_\+free()}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{group__Eina__Memory__Pool__Group_ga6099d5613e58b42be2aebfbff5c10604}\label{group__Eina__Memory__Pool__Group_ga6099d5613e58b42be2aebfbff5c10604}} 
\index{Memory Pool@{Memory Pool}!eina\_mempool\_malloc\_near@{eina\_mempool\_malloc\_near}}
\index{eina\_mempool\_malloc\_near@{eina\_mempool\_malloc\_near}!Memory Pool@{Memory Pool}}
\doxysubsubsection{\texorpdfstring{eina\_mempool\_malloc\_near()}{eina\_mempool\_malloc\_near()}}
{\footnotesize\ttfamily static void $\ast$ eina\+\_\+mempool\+\_\+malloc\+\_\+near (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__Eina__Memory__Pool__Group_ga8ca45185c6759c6c7b57e7c1b614215a}{Eina\+\_\+\+Mempool}} $\ast$}]{mp,  }\item[{void $\ast$}]{after,  }\item[{void $\ast$}]{before,  }\item[{unsigned int}]{size }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



Allocates memory in the given mempool using locality hint to improve future memory access use. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em mp} & The mempool \\
\hline
\mbox{\texttt{ in}}  & {\em after} & Hint to the nearest pointer after which to try find an empty spot. \\
\hline
\mbox{\texttt{ in}}  & {\em before} & Hint to the nearest pointer before which to try find an empty spot. \\
\hline
\mbox{\texttt{ in}}  & {\em size} & The size in bytes to allocate \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The newly allocated data that might be near {\ttfamily after} and {\ttfamily before}.
\end{DoxyReturn}
This function is to be used to improve cache locality of structure that are likely to be used one after another. An example of this use would be Eina\+\_\+\+List.

\begin{DoxyNote}{Note}
This function allocates and returns {\ttfamily size} bytes using the mempool {\ttfamily mp}. If not used anymore, the data must be freed with \mbox{\hyperlink{group__Eina__Memory__Pool__Group_gab863371d668381f7bca07d6fafcc2fc2}{eina\+\_\+mempool\+\_\+free()}}. 

{\ttfamily after} and {\ttfamily before} must be either {\ttfamily NULL} or allocated by the same mempool {\ttfamily mp}. They are hint and if no space near them is found, memory will be allocated without locality improvement. 
\end{DoxyNote}
\begin{DoxyWarning}{Warning}
No checks are done for {\ttfamily mp}.
\end{DoxyWarning}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{group__Eina__Memory__Pool__Group_gab863371d668381f7bca07d6fafcc2fc2}{eina\+\_\+mempool\+\_\+free()}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{group__Eina__Memory__Pool__Group_ga224fe9097f28eb89da102ceb942b5c9b}\label{group__Eina__Memory__Pool__Group_ga224fe9097f28eb89da102ceb942b5c9b}} 
\index{Memory Pool@{Memory Pool}!eina\_mempool\_calloc@{eina\_mempool\_calloc}}
\index{eina\_mempool\_calloc@{eina\_mempool\_calloc}!Memory Pool@{Memory Pool}}
\doxysubsubsection{\texorpdfstring{eina\_mempool\_calloc()}{eina\_mempool\_calloc()}}
{\footnotesize\ttfamily static void $\ast$ eina\+\_\+mempool\+\_\+calloc (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__Eina__Memory__Pool__Group_ga8ca45185c6759c6c7b57e7c1b614215a}{Eina\+\_\+\+Mempool}} $\ast$}]{mp,  }\item[{unsigned int}]{size }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



Allocates and zeros memory using the given mempool. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em mp} & The mempool \\
\hline
\mbox{\texttt{ in}}  & {\em size} & The size in bytes to allocate \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The newly allocated data
\end{DoxyReturn}
This function allocates, zeroes, and returns {\ttfamily size} bytes using the mempool {\ttfamily mp}. If not used anymore, the data must be freed with \mbox{\hyperlink{group__Eina__Memory__Pool__Group_gab863371d668381f7bca07d6fafcc2fc2}{eina\+\_\+mempool\+\_\+free()}}. \begin{DoxyWarning}{Warning}
No checks are done for {\ttfamily mp}.
\end{DoxyWarning}
\begin{DoxySince}{Since}
1.\+2
\end{DoxySince}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{group__Eina__Memory__Pool__Group_gab863371d668381f7bca07d6fafcc2fc2}{eina\+\_\+mempool\+\_\+free()}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{group__Eina__Memory__Pool__Group_gab863371d668381f7bca07d6fafcc2fc2}\label{group__Eina__Memory__Pool__Group_gab863371d668381f7bca07d6fafcc2fc2}} 
\index{Memory Pool@{Memory Pool}!eina\_mempool\_free@{eina\_mempool\_free}}
\index{eina\_mempool\_free@{eina\_mempool\_free}!Memory Pool@{Memory Pool}}
\doxysubsubsection{\texorpdfstring{eina\_mempool\_free()}{eina\_mempool\_free()}}
{\footnotesize\ttfamily static void eina\+\_\+mempool\+\_\+free (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__Eina__Memory__Pool__Group_ga8ca45185c6759c6c7b57e7c1b614215a}{Eina\+\_\+\+Mempool}} $\ast$}]{mp,  }\item[{void $\ast$}]{element }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



Frees resources previously allocated by the given mempool. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em mp} & The mempool \\
\hline
\mbox{\texttt{ in}}  & {\em element} & The data to free\\
\hline
\end{DoxyParams}
This function frees {\ttfamily element} allocated by {\ttfamily mp}. {\ttfamily element} must have been obtained from \mbox{\hyperlink{group__Eina__Memory__Pool__Group_ga2518cc9ac3b8f0e8947e208e309503b9}{eina\+\_\+mempool\+\_\+malloc()}}, \mbox{\hyperlink{group__Eina__Memory__Pool__Group_ga224fe9097f28eb89da102ceb942b5c9b}{eina\+\_\+mempool\+\_\+calloc()}}, or \mbox{\hyperlink{group__Eina__Memory__Pool__Group_ga90b737a5553eb7ed7fe91af1c8127132}{eina\+\_\+mempool\+\_\+realloc()}}.

\begin{DoxyWarning}{Warning}
No checks are done for {\ttfamily mp}.
\end{DoxyWarning}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{group__Eina__Memory__Pool__Group_ga2518cc9ac3b8f0e8947e208e309503b9}{eina\+\_\+mempool\+\_\+malloc()}} 

\mbox{\hyperlink{group__Eina__Memory__Pool__Group_ga224fe9097f28eb89da102ceb942b5c9b}{eina\+\_\+mempool\+\_\+calloc()}} 

\mbox{\hyperlink{group__Eina__Memory__Pool__Group_ga90b737a5553eb7ed7fe91af1c8127132}{eina\+\_\+mempool\+\_\+realloc()}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{group__Eina__Memory__Pool__Group_gad90b9562051aa98f5e89689c1064c22e}\label{group__Eina__Memory__Pool__Group_gad90b9562051aa98f5e89689c1064c22e}} 
\index{Memory Pool@{Memory Pool}!eina\_mempool\_repack@{eina\_mempool\_repack}}
\index{eina\_mempool\_repack@{eina\_mempool\_repack}!Memory Pool@{Memory Pool}}
\doxysubsubsection{\texorpdfstring{eina\_mempool\_repack()}{eina\_mempool\_repack()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__Eina__Types__Group_ga6ac08753ba12bc9c7a0390cf67868f4f}{EINA\+\_\+\+API}} void eina\+\_\+mempool\+\_\+repack (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__Eina__Memory__Pool__Group_ga8ca45185c6759c6c7b57e7c1b614215a}{Eina\+\_\+\+Mempool}} $\ast$}]{mp,  }\item[{\mbox{\hyperlink{group__Eina__Memory__Pool__Group_ga36987f282791adfc0d82c493af4462dc}{Eina\+\_\+\+Mempool\+\_\+\+Repack\+\_\+\+Cb}}}]{cb,  }\item[{void $\ast$}]{data }\end{DoxyParamCaption})}



Repacks the objects in the mempool. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em mp} & The mempool \\
\hline
\mbox{\texttt{ in}}  & {\em cb} & A callback to update the pointers the objects with their new location \\
\hline
\mbox{\texttt{ in}}  & {\em data} & Data to pass as third argument to {\ttfamily cb} \\
\hline
\end{DoxyParams}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{group__Eina__Memory__Pool__Group_ga36987f282791adfc0d82c493af4462dc}{Eina\+\_\+\+Mempool\+\_\+\+Repack\+\_\+\+Cb}} 

\mbox{\hyperlink{struct__Eina__Mempool__Backend}{\+\_\+\+Eina\+\_\+\+Mempool\+\_\+\+Backend}} 
\end{DoxySeeAlso}


References \mbox{\hyperlink{group__Eina__Safety__Checks__Group_ga1ccf8538d0015b3801ff642e6156843a}{EINA\+\_\+\+SAFETY\+\_\+\+ON\+\_\+\+NULL\+\_\+\+RETURN}}.

\mbox{\Hypertarget{group__Eina__Memory__Pool__Group_ga95cabe35226f60ce2e22aea1df0087ca}\label{group__Eina__Memory__Pool__Group_ga95cabe35226f60ce2e22aea1df0087ca}} 
\index{Memory Pool@{Memory Pool}!eina\_mempool\_gc@{eina\_mempool\_gc}}
\index{eina\_mempool\_gc@{eina\_mempool\_gc}!Memory Pool@{Memory Pool}}
\doxysubsubsection{\texorpdfstring{eina\_mempool\_gc()}{eina\_mempool\_gc()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__Eina__Types__Group_ga6ac08753ba12bc9c7a0390cf67868f4f}{EINA\+\_\+\+API}} void eina\+\_\+mempool\+\_\+gc (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__Eina__Memory__Pool__Group_ga8ca45185c6759c6c7b57e7c1b614215a}{Eina\+\_\+\+Mempool}} $\ast$}]{mp }\end{DoxyParamCaption})}



Runs a garbage collection cycle. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em mp} & The mempool \\
\hline
\end{DoxyParams}


References \mbox{\hyperlink{group__Eina__Safety__Checks__Group_ga1ccf8538d0015b3801ff642e6156843a}{EINA\+\_\+\+SAFETY\+\_\+\+ON\+\_\+\+NULL\+\_\+\+RETURN}}.

\mbox{\Hypertarget{group__Eina__Memory__Pool__Group_ga3b619cca8ce4a3cb35ca93907f5be0d3}\label{group__Eina__Memory__Pool__Group_ga3b619cca8ce4a3cb35ca93907f5be0d3}} 
\index{Memory Pool@{Memory Pool}!eina\_mempool\_from@{eina\_mempool\_from}}
\index{eina\_mempool\_from@{eina\_mempool\_from}!Memory Pool@{Memory Pool}}
\doxysubsubsection{\texorpdfstring{eina\_mempool\_from()}{eina\_mempool\_from()}}
{\footnotesize\ttfamily static \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\+\_\+\+Bool}} eina\+\_\+mempool\+\_\+from (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__Eina__Memory__Pool__Group_ga8ca45185c6759c6c7b57e7c1b614215a}{Eina\+\_\+\+Mempool}} $\ast$}]{mp,  }\item[{void $\ast$}]{element }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



Check if a pointer is a valid element from the mempool. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em mp} & The mempool \\
\hline
\mbox{\texttt{ in}}  & {\em element} & The data to free \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
\mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\+\_\+\+TRUE}} if the element is a valid element of the mempool, \mbox{\hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\+\_\+\+FALSE}} otherwise
\end{DoxyReturn}
\begin{DoxySince}{Since}
1.\+20 
\end{DoxySince}
\mbox{\Hypertarget{group__Eina__Memory__Pool__Group_ga83214b1782a47f139aa31224faccae96}\label{group__Eina__Memory__Pool__Group_ga83214b1782a47f139aa31224faccae96}} 
\index{Memory Pool@{Memory Pool}!eina\_mempool\_statistics@{eina\_mempool\_statistics}}
\index{eina\_mempool\_statistics@{eina\_mempool\_statistics}!Memory Pool@{Memory Pool}}
\doxysubsubsection{\texorpdfstring{eina\_mempool\_statistics()}{eina\_mempool\_statistics()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__Eina__Types__Group_ga6ac08753ba12bc9c7a0390cf67868f4f}{EINA\+\_\+\+API}} void eina\+\_\+mempool\+\_\+statistics (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__Eina__Memory__Pool__Group_ga8ca45185c6759c6c7b57e7c1b614215a}{Eina\+\_\+\+Mempool}} $\ast$}]{mp }\end{DoxyParamCaption})}



Has the backend update its internal statistics. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em mp} & The mempool \\
\hline
\end{DoxyParams}


References \mbox{\hyperlink{group__Eina__Safety__Checks__Group_ga1ccf8538d0015b3801ff642e6156843a}{EINA\+\_\+\+SAFETY\+\_\+\+ON\+\_\+\+NULL\+\_\+\+RETURN}}.

\mbox{\Hypertarget{group__Eina__Memory__Pool__Group_ga252ed0556dfb25d068ac30fd0dbe9653}\label{group__Eina__Memory__Pool__Group_ga252ed0556dfb25d068ac30fd0dbe9653}} 
\index{Memory Pool@{Memory Pool}!eina\_mempool\_iterator\_new@{eina\_mempool\_iterator\_new}}
\index{eina\_mempool\_iterator\_new@{eina\_mempool\_iterator\_new}!Memory Pool@{Memory Pool}}
\doxysubsubsection{\texorpdfstring{eina\_mempool\_iterator\_new()}{eina\_mempool\_iterator\_new()}}
{\footnotesize\ttfamily static \mbox{\hyperlink{group__Eina__Iterator__Group_ga15b975bb881d955249ce13d4ebc96948}{Eina\+\_\+\+Iterator}} $\ast$ eina\+\_\+mempool\+\_\+iterator\+\_\+new (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__Eina__Memory__Pool__Group_ga8ca45185c6759c6c7b57e7c1b614215a}{Eina\+\_\+\+Mempool}} $\ast$}]{mp }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



Provide an iterator to walk all allocated elements from a specified mempool. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em mp} & The mempool \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
{\ttfamily NULL} if it is not possible to iterate over the mempool, a valid iterator otherwise.
\end{DoxyReturn}
\begin{DoxyNote}{Note}
This call is expected to be slow and should not be used in any performance critical area. 
\end{DoxyNote}
\begin{DoxySince}{Since}
1.\+23 
\end{DoxySince}
\mbox{\Hypertarget{group__Eina__Memory__Pool__Group_ga644320f3f3146c8e0512ea7e0acacf76}\label{group__Eina__Memory__Pool__Group_ga644320f3f3146c8e0512ea7e0acacf76}} 
\index{Memory Pool@{Memory Pool}!eina\_mempool\_register@{eina\_mempool\_register}}
\index{eina\_mempool\_register@{eina\_mempool\_register}!Memory Pool@{Memory Pool}}
\doxysubsubsection{\texorpdfstring{eina\_mempool\_register()}{eina\_mempool\_register()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__Eina__Types__Group_ga6ac08753ba12bc9c7a0390cf67868f4f}{EINA\+\_\+\+API}} \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\+\_\+\+Bool}} eina\+\_\+mempool\+\_\+register (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__Eina__Memory__Pool__Group_gaad1bbde75fe98f5cff269c0411678ff9}{Eina\+\_\+\+Mempool\+\_\+\+Backend}} $\ast$}]{be }\end{DoxyParamCaption})}



Registers the given memory pool backend. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em be} & The backend \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
\mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\+\_\+\+TRUE}} if backend has been correctly registered, \mbox{\hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\+\_\+\+FALSE}} otherwise. 
\end{DoxyReturn}


References \mbox{\hyperlink{group__Eina__Hash__Group_ga5e72d0c5397936512407ce8cd66e98d6}{eina\+\_\+hash\+\_\+add()}}, \mbox{\hyperlink{group__Eina__Safety__Checks__Group_gab2b07061fc6500dedd9cd41c8d16f95d}{EINA\+\_\+\+SAFETY\+\_\+\+ON\+\_\+\+NULL\+\_\+\+RETURN\+\_\+\+VAL}}, and \mbox{\hyperlink{struct__Eina__Mempool__Backend_a03fbd81b9a7ec3896a7d1afe3e0266ca}{\+\_\+\+Eina\+\_\+\+Mempool\+\_\+\+Backend\+::name}}.

\mbox{\Hypertarget{group__Eina__Memory__Pool__Group_gaa4955a8c3af9a4da532d05d8be132848}\label{group__Eina__Memory__Pool__Group_gaa4955a8c3af9a4da532d05d8be132848}} 
\index{Memory Pool@{Memory Pool}!eina\_mempool\_unregister@{eina\_mempool\_unregister}}
\index{eina\_mempool\_unregister@{eina\_mempool\_unregister}!Memory Pool@{Memory Pool}}
\doxysubsubsection{\texorpdfstring{eina\_mempool\_unregister()}{eina\_mempool\_unregister()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__Eina__Types__Group_ga6ac08753ba12bc9c7a0390cf67868f4f}{EINA\+\_\+\+API}} void eina\+\_\+mempool\+\_\+unregister (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__Eina__Memory__Pool__Group_gaad1bbde75fe98f5cff269c0411678ff9}{Eina\+\_\+\+Mempool\+\_\+\+Backend}} $\ast$}]{be }\end{DoxyParamCaption})}



Unregisters the given memory pool backend. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em be} & The backend \\
\hline
\end{DoxyParams}


References \mbox{\hyperlink{group__Eina__Hash__Group_ga315f85c5deae8e099e5a5a17d3557456}{eina\+\_\+hash\+\_\+del()}}, \mbox{\hyperlink{group__Eina__Safety__Checks__Group_ga1ccf8538d0015b3801ff642e6156843a}{EINA\+\_\+\+SAFETY\+\_\+\+ON\+\_\+\+NULL\+\_\+\+RETURN}}, and \mbox{\hyperlink{struct__Eina__Mempool__Backend_a03fbd81b9a7ec3896a7d1afe3e0266ca}{\+\_\+\+Eina\+\_\+\+Mempool\+\_\+\+Backend\+::name}}.

\mbox{\Hypertarget{group__Eina__Memory__Pool__Group_gaf91146872014f8a8df3abe29b83356fe}\label{group__Eina__Memory__Pool__Group_gaf91146872014f8a8df3abe29b83356fe}} 
\index{Memory Pool@{Memory Pool}!eina\_mempool\_alignof@{eina\_mempool\_alignof}}
\index{eina\_mempool\_alignof@{eina\_mempool\_alignof}!Memory Pool@{Memory Pool}}
\doxysubsubsection{\texorpdfstring{eina\_mempool\_alignof()}{eina\_mempool\_alignof()}}
{\footnotesize\ttfamily static unsigned int eina\+\_\+mempool\+\_\+alignof (\begin{DoxyParamCaption}\item[{unsigned int}]{size }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



Computes the alignment that would be used when allocating a object of size {\ttfamily size}. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em size} & \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The alignment for an allocation of size {\ttfamily size}. 
\end{DoxyReturn}


References \mbox{\hyperlink{group__Eina__Types__Group_ga70675a75a5fb3e9a51d5af985a1fd3aa}{EINA\+\_\+\+UNLIKELY}}.



Referenced by \mbox{\hyperlink{group__Eina__Cow__Group_ga0c55f4406fbf96dca46de08719413153}{eina\+\_\+cow\+\_\+add()}}.

