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


These functions provide memory pool management.  


\subsection*{Data Structures}
\begin{DoxyCompactItemize}
\item 
struct \hyperlink{struct__Eina__Mempool__Backend}{\-\_\-\-Eina\-\_\-\-Mempool\-\_\-\-Backend}
\item 
struct \hyperlink{struct__Eina__Mempool__Backend__ABI1}{\-\_\-\-Eina\-\_\-\-Mempool\-\_\-\-Backend\-\_\-\-A\-B\-I1}
\item 
struct \hyperlink{struct__Eina__Mempool__Backend__ABI2}{\-\_\-\-Eina\-\_\-\-Mempool\-\_\-\-Backend\-\_\-\-A\-B\-I2}
\item 
struct \hyperlink{struct__Eina__Mempool}{\-\_\-\-Eina\-\_\-\-Mempool}
\end{DoxyCompactItemize}
\subsection*{Typedefs}
\begin{DoxyCompactItemize}
\item 
\hypertarget{group__Eina__Memory__Pool__Group_ga5b7297e0c4911e1d8da38e536e00aca9}{typedef struct \\*
\hyperlink{struct__Eina__Mempool__Backend__ABI1}{\-\_\-\-Eina\-\_\-\-Mempool\-\_\-\-Backend\-\_\-\-A\-B\-I1} {\bfseries Eina\-\_\-\-Mempool\-\_\-\-Backend\-\_\-\-A\-B\-I1}}\label{group__Eina__Memory__Pool__Group_ga5b7297e0c4911e1d8da38e536e00aca9}

\item 
\hypertarget{group__Eina__Memory__Pool__Group_ga85eb4f745535ccab585f719d0c656de7}{typedef struct \\*
\hyperlink{struct__Eina__Mempool__Backend__ABI2}{\-\_\-\-Eina\-\_\-\-Mempool\-\_\-\-Backend\-\_\-\-A\-B\-I2} {\bfseries Eina\-\_\-\-Mempool\-\_\-\-Backend\-\_\-\-A\-B\-I2}}\label{group__Eina__Memory__Pool__Group_ga85eb4f745535ccab585f719d0c656de7}

\item 
\hypertarget{group__Eina__Memory__Pool__Group_ga8ca45185c6759c6c7b57e7c1b614215a}{typedef struct \hyperlink{struct__Eina__Mempool}{\-\_\-\-Eina\-\_\-\-Mempool} \hyperlink{group__Eina__Memory__Pool__Group_ga8ca45185c6759c6c7b57e7c1b614215a}{Eina\-\_\-\-Mempool}}\label{group__Eina__Memory__Pool__Group_ga8ca45185c6759c6c7b57e7c1b614215a}

\begin{DoxyCompactList}\small\item\em Mempool type. \end{DoxyCompactList}\item 
\hypertarget{group__Eina__Memory__Pool__Group_gaad1bbde75fe98f5cff269c0411678ff9}{typedef struct \\*
\hyperlink{struct__Eina__Mempool__Backend}{\-\_\-\-Eina\-\_\-\-Mempool\-\_\-\-Backend} \hyperlink{group__Eina__Memory__Pool__Group_gaad1bbde75fe98f5cff269c0411678ff9}{Eina\-\_\-\-Mempool\-\_\-\-Backend}}\label{group__Eina__Memory__Pool__Group_gaad1bbde75fe98f5cff269c0411678ff9}

\begin{DoxyCompactList}\small\item\em Mempool backend type. \end{DoxyCompactList}\item 
typedef void($\ast$ \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 Type for a callback who need to unreference an old object from a mempool and reference the new one instead. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
static void $\ast$ \hyperlink{group__Eina__Memory__Pool__Group_ga7f15747ff472c6f051299284d64b5983}{eina\-\_\-mempool\-\_\-realloc} (\hyperlink{group__Eina__Memory__Pool__Group_ga8ca45185c6759c6c7b57e7c1b614215a}{Eina\-\_\-\-Mempool} $\ast$mp, void $\ast$element, unsigned int size)
\begin{DoxyCompactList}\small\item\em Re-\/allocate an amount memory by the given mempool. \end{DoxyCompactList}\item 
static void $\ast$ \hyperlink{group__Eina__Memory__Pool__Group_gabbdb8f387ae2e475f743ca86ef980d08}{eina\-\_\-mempool\-\_\-malloc} (\hyperlink{group__Eina__Memory__Pool__Group_ga8ca45185c6759c6c7b57e7c1b614215a}{Eina\-\_\-\-Mempool} $\ast$mp, unsigned int size)
\begin{DoxyCompactList}\small\item\em Allocate memory using the given mempool. \end{DoxyCompactList}\item 
static void $\ast$ \hyperlink{group__Eina__Memory__Pool__Group_gab9f29782c01cb62d2b70bc65c6fa5e1b}{eina\-\_\-mempool\-\_\-calloc} (\hyperlink{group__Eina__Memory__Pool__Group_ga8ca45185c6759c6c7b57e7c1b614215a}{Eina\-\_\-\-Mempool} $\ast$mp, unsigned int size)
\begin{DoxyCompactList}\small\item\em Allocate and zero memory using the given mempool. \end{DoxyCompactList}\item 
static void \hyperlink{group__Eina__Memory__Pool__Group_gab863371d668381f7bca07d6fafcc2fc2}{eina\-\_\-mempool\-\_\-free} (\hyperlink{group__Eina__Memory__Pool__Group_ga8ca45185c6759c6c7b57e7c1b614215a}{Eina\-\_\-\-Mempool} $\ast$mp, void $\ast$element)
\begin{DoxyCompactList}\small\item\em Free resources previously allocated by the given mempool. \end{DoxyCompactList}\item 
\hypertarget{group__Eina__Memory__Pool__Group_gaf91146872014f8a8df3abe29b83356fe}{static unsigned int {\bfseries eina\-\_\-mempool\-\_\-alignof} (unsigned int size)}\label{group__Eina__Memory__Pool__Group_gaf91146872014f8a8df3abe29b83356fe}

\item 
\hypertarget{group__Eina__Memory__Pool__Group_gad72bac7ce820b2395a9521f51b6896c8}{\hyperlink{group__Eina__Memory__Pool__Group_ga8ca45185c6759c6c7b57e7c1b614215a}{Eina\-\_\-\-Mempool} $\ast$ {\bfseries eina\-\_\-mempool\-\_\-add} (const char $\ast$module, const char $\ast$context, const char $\ast$options,...)}\label{group__Eina__Memory__Pool__Group_gad72bac7ce820b2395a9521f51b6896c8}

\item 
\hypertarget{group__Eina__Memory__Pool__Group_ga08462e7e67031eb416ffab31e9c2a6cc}{void {\bfseries eina\-\_\-mempool\-\_\-del} (\hyperlink{group__Eina__Memory__Pool__Group_ga8ca45185c6759c6c7b57e7c1b614215a}{Eina\-\_\-\-Mempool} $\ast$mp)}\label{group__Eina__Memory__Pool__Group_ga08462e7e67031eb416ffab31e9c2a6cc}

\item 
\hypertarget{group__Eina__Memory__Pool__Group_ga54f212b90f7a16dffd803e38cb9b401e}{void {\bfseries eina\-\_\-mempool\-\_\-repack} (\hyperlink{group__Eina__Memory__Pool__Group_ga8ca45185c6759c6c7b57e7c1b614215a}{Eina\-\_\-\-Mempool} $\ast$mp, \hyperlink{group__Eina__Memory__Pool__Group_ga36987f282791adfc0d82c493af4462dc}{Eina\-\_\-\-Mempool\-\_\-\-Repack\-\_\-\-Cb} cb, void $\ast$data)}\label{group__Eina__Memory__Pool__Group_ga54f212b90f7a16dffd803e38cb9b401e}

\item 
\hypertarget{group__Eina__Memory__Pool__Group_ga82e20bb9b578f1430b8446af118afccd}{void {\bfseries eina\-\_\-mempool\-\_\-gc} (\hyperlink{group__Eina__Memory__Pool__Group_ga8ca45185c6759c6c7b57e7c1b614215a}{Eina\-\_\-\-Mempool} $\ast$mp)}\label{group__Eina__Memory__Pool__Group_ga82e20bb9b578f1430b8446af118afccd}

\item 
\hypertarget{group__Eina__Memory__Pool__Group_ga86cf0b5dcb42ebbb6e9314dd56916f45}{void {\bfseries eina\-\_\-mempool\-\_\-statistics} (\hyperlink{group__Eina__Memory__Pool__Group_ga8ca45185c6759c6c7b57e7c1b614215a}{Eina\-\_\-\-Mempool} $\ast$mp)}\label{group__Eina__Memory__Pool__Group_ga86cf0b5dcb42ebbb6e9314dd56916f45}

\item 
\hypertarget{group__Eina__Memory__Pool__Group_gae11448767cf8ca94752df0ca1f54221e}{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\-\_\-\-Bool} {\bfseries eina\-\_\-mempool\-\_\-register} (\hyperlink{group__Eina__Memory__Pool__Group_gaad1bbde75fe98f5cff269c0411678ff9}{Eina\-\_\-\-Mempool\-\_\-\-Backend} $\ast$be)}\label{group__Eina__Memory__Pool__Group_gae11448767cf8ca94752df0ca1f54221e}

\item 
\hypertarget{group__Eina__Memory__Pool__Group_ga6e284c95e35391579a77f24581ad3304}{void {\bfseries eina\-\_\-mempool\-\_\-unregister} (\hyperlink{group__Eina__Memory__Pool__Group_gaad1bbde75fe98f5cff269c0411678ff9}{Eina\-\_\-\-Mempool\-\_\-\-Backend} $\ast$be)}\label{group__Eina__Memory__Pool__Group_ga6e284c95e35391579a77f24581ad3304}

\end{DoxyCompactItemize}
\subsection*{Variables}
\begin{DoxyCompactItemize}
\item 
\hypertarget{group__Eina__Memory__Pool__Group_gacbc6db834ac68b83684f83e55193be4a}{\hyperlink{group__Eina__Error__Group_ga95b3cbb33e987e7d92a81ea785001686}{Eina\-\_\-\-Error} {\bfseries E\-I\-N\-A\-\_\-\-E\-R\-R\-O\-R\-\_\-\-N\-O\-T\-\_\-\-M\-E\-M\-P\-O\-O\-L\-\_\-\-M\-O\-D\-U\-L\-E}}\label{group__Eina__Memory__Pool__Group_gacbc6db834ac68b83684f83e55193be4a}

\end{DoxyCompactItemize}


\subsection{Detailed Description}
These functions provide memory pool management. Several mempool are available\-:

\begin{DoxyItemize}
\item {\ttfamily chained\-\_\-pool\-:} It is the default one. It allocates a big chunk of memory with malloc() and split the result in 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 4\-M\-B). \item {\ttfamily one\-\_\-big\-:} It call just one time malloc for the requested number of items. Useful when you know in advance how many object of some type will live during the life of the mempool. \end{DoxyItemize}


\subsection{Typedef Documentation}
\hypertarget{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}}
\subsubsection[{Eina\-\_\-\-Mempool\-\_\-\-Repack\-\_\-\-Cb}]{\setlength{\rightskip}{0pt plus 5cm}Eina\-\_\-\-Mempool\-\_\-\-Repack\-\_\-\-Cb}}\label{group__Eina__Memory__Pool__Group_ga36987f282791adfc0d82c493af4462dc}


Type for a callback who need to unreference an old object from a mempool and reference the new one instead. 

Memcpy is taken care by the mempool. 

\subsection{Function Documentation}
\hypertarget{group__Eina__Memory__Pool__Group_ga7f15747ff472c6f051299284d64b5983}{\index{Memory Pool@{Memory Pool}!eina\-\_\-mempool\-\_\-realloc@{eina\-\_\-mempool\-\_\-realloc}}
\index{eina\-\_\-mempool\-\_\-realloc@{eina\-\_\-mempool\-\_\-realloc}!Memory Pool@{Memory Pool}}
\subsubsection[{eina\-\_\-mempool\-\_\-realloc}]{\setlength{\rightskip}{0pt plus 5cm}static void$\ast$ eina\-\_\-mempool\-\_\-realloc (
\begin{DoxyParamCaption}
\item[{{\bf Eina\-\_\-\-Mempool} $\ast$}]{mp, }
\item[{void $\ast$}]{element, }
\item[{unsigned int}]{size}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}}\label{group__Eina__Memory__Pool__Group_ga7f15747ff472c6f051299284d64b5983}


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


\begin{DoxyParams}{Parameters}
{\em mp} & The mempool. \\
\hline
{\em element} & The element to re-\/allocate. \\
\hline
{\em size} & The size in bytes to re-\/allocate. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The newly re-\/allocated data.
\end{DoxyReturn}
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 \hyperlink{group__Eina__Memory__Pool__Group_gab863371d668381f7bca07d6fafcc2fc2}{eina\-\_\-mempool\-\_\-free()}. \begin{DoxyWarning}{Warning}
No checks are done for {\ttfamily mp}. 
\end{DoxyWarning}
\hypertarget{group__Eina__Memory__Pool__Group_gabbdb8f387ae2e475f743ca86ef980d08}{\index{Memory Pool@{Memory Pool}!eina\-\_\-mempool\-\_\-malloc@{eina\-\_\-mempool\-\_\-malloc}}
\index{eina\-\_\-mempool\-\_\-malloc@{eina\-\_\-mempool\-\_\-malloc}!Memory Pool@{Memory Pool}}
\subsubsection[{eina\-\_\-mempool\-\_\-malloc}]{\setlength{\rightskip}{0pt plus 5cm}static void$\ast$ eina\-\_\-mempool\-\_\-malloc (
\begin{DoxyParamCaption}
\item[{{\bf Eina\-\_\-\-Mempool} $\ast$}]{mp, }
\item[{unsigned int}]{size}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}}\label{group__Eina__Memory__Pool__Group_gabbdb8f387ae2e475f743ca86ef980d08}


Allocate memory using the given mempool. 


\begin{DoxyParams}{Parameters}
{\em mp} & The mempool. \\
\hline
{\em size} & The size in bytes to allocate. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The newly allocated data.
\end{DoxyReturn}
This function allocates and returns {\ttfamily size} bytes using the mempool {\ttfamily mp}. If not used anymore, the data must be freed with \hyperlink{group__Eina__Memory__Pool__Group_gab863371d668381f7bca07d6fafcc2fc2}{eina\-\_\-mempool\-\_\-free()}. \begin{DoxyWarning}{Warning}
No checks are done for {\ttfamily mp}. 
\end{DoxyWarning}


Referenced by eina\-\_\-cow\-\_\-write(), eina\-\_\-rectangle\-\_\-new(), eina\-\_\-rectangle\-\_\-pool\-\_\-request(), eina\-\_\-simple\-\_\-xml\-\_\-attribute\-\_\-new(), eina\-\_\-simple\-\_\-xml\-\_\-node\-\_\-load(), eina\-\_\-simple\-\_\-xml\-\_\-node\-\_\-tag\-\_\-new(), eina\-\_\-value\-\_\-array\-\_\-new(), eina\-\_\-value\-\_\-hash\-\_\-new(), eina\-\_\-value\-\_\-list\-\_\-new(), eina\-\_\-value\-\_\-new(), and eina\-\_\-value\-\_\-struct\-\_\-new().

\hypertarget{group__Eina__Memory__Pool__Group_gab9f29782c01cb62d2b70bc65c6fa5e1b}{\index{Memory Pool@{Memory Pool}!eina\-\_\-mempool\-\_\-calloc@{eina\-\_\-mempool\-\_\-calloc}}
\index{eina\-\_\-mempool\-\_\-calloc@{eina\-\_\-mempool\-\_\-calloc}!Memory Pool@{Memory Pool}}
\subsubsection[{eina\-\_\-mempool\-\_\-calloc}]{\setlength{\rightskip}{0pt plus 5cm}static void$\ast$ eina\-\_\-mempool\-\_\-calloc (
\begin{DoxyParamCaption}
\item[{{\bf Eina\-\_\-\-Mempool} $\ast$}]{mp, }
\item[{unsigned int}]{size}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}}\label{group__Eina__Memory__Pool__Group_gab9f29782c01cb62d2b70bc65c6fa5e1b}


Allocate and zero memory using the given mempool. 


\begin{DoxyParams}{Parameters}
{\em mp} & The mempool. \\
\hline
{\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 \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}
\hypertarget{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}}
\subsubsection[{eina\-\_\-mempool\-\_\-free}]{\setlength{\rightskip}{0pt plus 5cm}static void eina\-\_\-mempool\-\_\-free (
\begin{DoxyParamCaption}
\item[{{\bf Eina\-\_\-\-Mempool} $\ast$}]{mp, }
\item[{void $\ast$}]{element}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}}\label{group__Eina__Memory__Pool__Group_gab863371d668381f7bca07d6fafcc2fc2}


Free resources previously allocated by the given mempool. 


\begin{DoxyParams}{Parameters}
{\em mp} & The mempool. \\
\hline
{\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 \hyperlink{group__Eina__Memory__Pool__Group_gabbdb8f387ae2e475f743ca86ef980d08}{eina\-\_\-mempool\-\_\-malloc()}, \hyperlink{group__Eina__Memory__Pool__Group_gab9f29782c01cb62d2b70bc65c6fa5e1b}{eina\-\_\-mempool\-\_\-calloc()}, or \hyperlink{group__Eina__Memory__Pool__Group_ga7f15747ff472c6f051299284d64b5983}{eina\-\_\-mempool\-\_\-realloc()}. \begin{DoxyWarning}{Warning}
No checks are done for {\ttfamily mp}. 
\end{DoxyWarning}


Referenced by edje\-\_\-edit\-\_\-part\-\_\-del(), eina\-\_\-cow\-\_\-free(), eina\-\_\-rectangle\-\_\-free(), eina\-\_\-rectangle\-\_\-pool\-\_\-free(), eina\-\_\-rectangle\-\_\-pool\-\_\-release(), eina\-\_\-simple\-\_\-xml\-\_\-attribute\-\_\-free(), eina\-\_\-value\-\_\-array\-\_\-new(), eina\-\_\-value\-\_\-free(), eina\-\_\-value\-\_\-hash\-\_\-new(), eina\-\_\-value\-\_\-list\-\_\-new(), and eina\-\_\-value\-\_\-struct\-\_\-new().

