\hypertarget{group__Eina__FreeQ__Group}{}\doxysection{Free Queue Group}
\label{group__Eina__FreeQ__Group}\index{Free Queue Group@{Free Queue Group}}


This provides a mechanism to defer actual freeing of memory data at some time in the future.  


\doxysubsection*{Macros}
\begin{DoxyCompactItemize}
\item 
\#define \mbox{\hyperlink{group__Eina__FreeQ__Group_ga1219f0559445ed399a931163736e0a4f}{EINA\+\_\+\+FREEQ\+\_\+\+FREE}}(ptr)~\mbox{\hyperlink{group__Eina__FreeQ__Group_gafe655be65cbf4f01310c2147c22f2c92}{eina\+\_\+freeq\+\_\+ptr\+\_\+main\+\_\+add}}(ptr, NULL, sizeof($\ast$(ptr)))
\begin{DoxyCompactList}\small\item\em Convenience macro for well known structures and types. \end{DoxyCompactList}\item 
\#define \mbox{\hyperlink{group__Eina__FreeQ__Group_ga7997c740db6b46e562ff053b49912188}{EINA\+\_\+\+FREEQ\+\_\+\+N\+\_\+\+FREE}}(ptr,  n)~\mbox{\hyperlink{group__Eina__FreeQ__Group_gafe655be65cbf4f01310c2147c22f2c92}{eina\+\_\+freeq\+\_\+ptr\+\_\+main\+\_\+add}}(ptr, NULL, sizeof($\ast$(ptr)) $\ast$ n)
\begin{DoxyCompactList}\small\item\em Convenience macro for well known structures and types. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Typedefs}
\begin{DoxyCompactItemize}
\item 
typedef struct \+\_\+\+Eina\+\_\+\+FreeQ \mbox{\hyperlink{group__Eina__FreeQ__Group_gaa950e27974a73908ef81a2bb20cf94c7}{Eina\+\_\+\+FreeQ}}
\begin{DoxyCompactList}\small\item\em A queue of pointers to free in the future. \end{DoxyCompactList}\item 
typedef enum \mbox{\hyperlink{group__Eina__FreeQ__Group_ga52c4eb7c091de64d45dc7a97c650eff4}{\+\_\+\+Eina\+\_\+\+Free\+Q\+\_\+\+Type}} \mbox{\hyperlink{group__Eina__FreeQ__Group_gadf7f65a475ab3d1e63214cfd3c9c4598}{Eina\+\_\+\+Free\+Q\+\_\+\+Type}}
\begin{DoxyCompactList}\small\item\em Type of free queues. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Enumerations}
\begin{DoxyCompactItemize}
\item 
enum \mbox{\hyperlink{group__Eina__FreeQ__Group_ga52c4eb7c091de64d45dc7a97c650eff4}{\+\_\+\+Eina\+\_\+\+Free\+Q\+\_\+\+Type}} \{ \newline
\mbox{\hyperlink{group__Eina__FreeQ__Group_gga52c4eb7c091de64d45dc7a97c650eff4a38a3a01f7a20cb8102d7747998118372}{EINA\+\_\+\+FREEQ\+\_\+\+DEFAULT}}
, \newline
\mbox{\hyperlink{group__Eina__FreeQ__Group_gga52c4eb7c091de64d45dc7a97c650eff4ad991b1175049f0befd977324e79e73cd}{EINA\+\_\+\+FREEQ\+\_\+\+POSTPONED}}
 \}
\begin{DoxyCompactList}\small\item\em Type of free queues. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
\mbox{\hyperlink{group__Eina__FreeQ__Group_gaa950e27974a73908ef81a2bb20cf94c7}{Eina\+\_\+\+FreeQ}} $\ast$ \mbox{\hyperlink{group__Eina__FreeQ__Group_gaf5891e010bb750a3358dc2aca643cef8}{eina\+\_\+freeq\+\_\+new}} (\mbox{\hyperlink{group__Eina__FreeQ__Group_gadf7f65a475ab3d1e63214cfd3c9c4598}{Eina\+\_\+\+Free\+Q\+\_\+\+Type}} type)
\begin{DoxyCompactList}\small\item\em Create a new free queue to defer freeing of data with. \end{DoxyCompactList}\item 
void \mbox{\hyperlink{group__Eina__FreeQ__Group_gaa39f5a69f7f82354fa4bdecf0e1c1f6b}{eina\+\_\+freeq\+\_\+free}} (\mbox{\hyperlink{group__Eina__FreeQ__Group_gaa950e27974a73908ef81a2bb20cf94c7}{Eina\+\_\+\+FreeQ}} $\ast$fq)
\begin{DoxyCompactList}\small\item\em Free a free queue and anything that is queued in it. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__Eina__FreeQ__Group_gadf7f65a475ab3d1e63214cfd3c9c4598}{Eina\+\_\+\+Free\+Q\+\_\+\+Type}} \mbox{\hyperlink{group__Eina__FreeQ__Group_ga5ea1e76adbb4a2ba39e40663ab1c65ba}{eina\+\_\+freeq\+\_\+type\+\_\+get}} (\mbox{\hyperlink{group__Eina__FreeQ__Group_gaa950e27974a73908ef81a2bb20cf94c7}{Eina\+\_\+\+FreeQ}} $\ast$fq)
\begin{DoxyCompactList}\small\item\em Query the type of a free queue. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__Eina__FreeQ__Group_gaa950e27974a73908ef81a2bb20cf94c7}{Eina\+\_\+\+FreeQ}} $\ast$ \mbox{\hyperlink{group__Eina__FreeQ__Group_ga11585a5f2b77a18bcb87b0587e91953d}{eina\+\_\+freeq\+\_\+main\+\_\+get}} (void)
\begin{DoxyCompactList}\small\item\em Get the main loop free queue. \end{DoxyCompactList}\item 
void \mbox{\hyperlink{group__Eina__FreeQ__Group_ga0c150fcdb735d20ca6555aaa7bb79e5d}{eina\+\_\+freeq\+\_\+count\+\_\+max\+\_\+set}} (\mbox{\hyperlink{group__Eina__FreeQ__Group_gaa950e27974a73908ef81a2bb20cf94c7}{Eina\+\_\+\+FreeQ}} $\ast$fq, int count)
\begin{DoxyCompactList}\small\item\em Set the maximum number of free pointers this queue is allowed. \end{DoxyCompactList}\item 
int \mbox{\hyperlink{group__Eina__FreeQ__Group_gaa5920dadcc29e1fea9a5acaed59da0a6}{eina\+\_\+freeq\+\_\+count\+\_\+max\+\_\+get}} (\mbox{\hyperlink{group__Eina__FreeQ__Group_gaa950e27974a73908ef81a2bb20cf94c7}{Eina\+\_\+\+FreeQ}} $\ast$fq)
\begin{DoxyCompactList}\small\item\em Get the maximum number of free pointers this queue is allowed. \end{DoxyCompactList}\item 
void \mbox{\hyperlink{group__Eina__FreeQ__Group_ga38653956652a03774810b270b0899379}{eina\+\_\+freeq\+\_\+mem\+\_\+max\+\_\+set}} (\mbox{\hyperlink{group__Eina__FreeQ__Group_gaa950e27974a73908ef81a2bb20cf94c7}{Eina\+\_\+\+FreeQ}} $\ast$fq, size\+\_\+t mem)
\begin{DoxyCompactList}\small\item\em Set the maximum amount of memory allowed. \end{DoxyCompactList}\item 
size\+\_\+t \mbox{\hyperlink{group__Eina__FreeQ__Group_ga1e93189eb3c2ee682ccef085639a6d58}{eina\+\_\+freeq\+\_\+mem\+\_\+max\+\_\+get}} (\mbox{\hyperlink{group__Eina__FreeQ__Group_gaa950e27974a73908ef81a2bb20cf94c7}{Eina\+\_\+\+FreeQ}} $\ast$fq)
\begin{DoxyCompactList}\small\item\em Get the maximum amount of memory allowed. \end{DoxyCompactList}\item 
void \mbox{\hyperlink{group__Eina__FreeQ__Group_ga979bb6163af485dc8c0199cddbfc2e1b}{eina\+\_\+freeq\+\_\+clear}} (\mbox{\hyperlink{group__Eina__FreeQ__Group_gaa950e27974a73908ef81a2bb20cf94c7}{Eina\+\_\+\+FreeQ}} $\ast$fq)
\begin{DoxyCompactList}\small\item\em Clear out all queued items to be freed by freeing them. \end{DoxyCompactList}\item 
void \mbox{\hyperlink{group__Eina__FreeQ__Group_ga6b79c51d50fb5a0feb77ca225be2ccee}{eina\+\_\+freeq\+\_\+reduce}} (\mbox{\hyperlink{group__Eina__FreeQ__Group_gaa950e27974a73908ef81a2bb20cf94c7}{Eina\+\_\+\+FreeQ}} $\ast$fq, int count)
\begin{DoxyCompactList}\small\item\em Reduce the number of items in the free queue by up to {\ttfamily count}. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\+\_\+\+Bool}} \mbox{\hyperlink{group__Eina__FreeQ__Group_ga3a5d2d5c564ca0da39400bfcedc77185}{eina\+\_\+freeq\+\_\+ptr\+\_\+pending}} (\mbox{\hyperlink{group__Eina__FreeQ__Group_gaa950e27974a73908ef81a2bb20cf94c7}{Eina\+\_\+\+FreeQ}} $\ast$fq)
\begin{DoxyCompactList}\small\item\em Return if there are any items pending a free in the free queue. \end{DoxyCompactList}\item 
void \mbox{\hyperlink{group__Eina__FreeQ__Group_gaacfa4ac2eee628ec39fdbeac7d5f7ad2}{eina\+\_\+freeq\+\_\+ptr\+\_\+add}} (\mbox{\hyperlink{group__Eina__FreeQ__Group_gaa950e27974a73908ef81a2bb20cf94c7}{Eina\+\_\+\+FreeQ}} $\ast$fq, void $\ast$ptr, void($\ast$free\+\_\+func)(void $\ast$ptr), size\+\_\+t size)
\begin{DoxyCompactList}\small\item\em Add a pointer with free function and size to the free queue. \end{DoxyCompactList}\item 
static void \mbox{\hyperlink{group__Eina__FreeQ__Group_gafe655be65cbf4f01310c2147c22f2c92}{eina\+\_\+freeq\+\_\+ptr\+\_\+main\+\_\+add}} (void $\ast$ptr, void($\ast$free\+\_\+func)(void $\ast$ptr), size\+\_\+t size)
\begin{DoxyCompactList}\small\item\em Add a pointer to the main free queue. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
This provides a mechanism to defer actual freeing of memory data at some time in the future. 

The main free queue will be driven by the EFL main loop and ensure data is eventually freed.

For debugging and tuning you may set the following environment variables, applicable only to free queues of the default type\+:

EINA\+\_\+\+FREEQ\+\_\+\+BYPASS=1/0

Set this environment variable to 1 to immediately bypass the free queue and have all items submitted free with their free function immediately. Set it to 0 to force the free queue to work and delay freeing of items. Note that you can override this by setting count or mem max by \mbox{\hyperlink{group__Eina__FreeQ__Group_ga0c150fcdb735d20ca6555aaa7bb79e5d}{eina\+\_\+freeq\+\_\+count\+\_\+max\+\_\+set()}} or \mbox{\hyperlink{group__Eina__FreeQ__Group_ga38653956652a03774810b270b0899379}{eina\+\_\+freeq\+\_\+mem\+\_\+max\+\_\+set()}} which will disable bypass for that specific free queue. Once bypass is disabled it cannot be re-\/enabled.

EINA\+\_\+\+FREEQ\+\_\+\+FILL\+\_\+\+MAX=N

This sets the maximum number of bytes to N an item in the free queue may be in size for the free queue to fill it with debugging values like 0x55 in every byte, to ensure you can see what memory has been freed or not when debugging in tools like gdb. Note that this value is actually one greater than the actual maximum, so if this is set to 100 a memory blob of 100 bytes will not be filled but one of 99 bytes in size will be.

EINA\+\_\+\+FREEQ\+\_\+\+TOTAL\+\_\+\+MAX=N

This sets the maximum number of items allowed to N on a free queue by default before it starts emptying the free queue out to make room.

EINA\+\_\+\+FREEQ\+\_\+\+MEM\+\_\+\+MAX=N

This sets the maximum total number of Kb (Kilobytes) of memory allowed on a free queue by default to N Kb worth of data.

EINA\+\_\+\+FREEQ\+\_\+\+FILL=N

This sets the byte value to write to every byte of an allocation that is added to the free queue when it is added to mark the data as invalid. The default value is 0x55 (85). Memory is only filled if the size of the allocation is less than the max that you can adjust with EINA\+\_\+\+FREEQ\+\_\+\+FILL\+\_\+\+MAX.

EINA\+\_\+\+FREEQ\+\_\+\+FILL\+\_\+\+FREED=N

Memory just before it is actually passed to the free function to be freed will be filled with this pattern value in every byte. The default value is 0x77 (119). Memory is only filled if the size of the allocation is less than the max that you can adjust with EINA\+\_\+\+FREEQ\+\_\+\+FILL\+\_\+\+MAX.

\begin{DoxySince}{Since}
1.\+19 
\end{DoxySince}


\doxysubsection{Macro Definition Documentation}
\mbox{\Hypertarget{group__Eina__FreeQ__Group_ga1219f0559445ed399a931163736e0a4f}\label{group__Eina__FreeQ__Group_ga1219f0559445ed399a931163736e0a4f}} 
\index{Free Queue Group@{Free Queue Group}!EINA\_FREEQ\_FREE@{EINA\_FREEQ\_FREE}}
\index{EINA\_FREEQ\_FREE@{EINA\_FREEQ\_FREE}!Free Queue Group@{Free Queue Group}}
\doxysubsubsection{\texorpdfstring{EINA\_FREEQ\_FREE}{EINA\_FREEQ\_FREE}}
{\footnotesize\ttfamily \#define EINA\+\_\+\+FREEQ\+\_\+\+FREE(\begin{DoxyParamCaption}\item[{}]{ptr }\end{DoxyParamCaption})~\mbox{\hyperlink{group__Eina__FreeQ__Group_gafe655be65cbf4f01310c2147c22f2c92}{eina\+\_\+freeq\+\_\+ptr\+\_\+main\+\_\+add}}(ptr, NULL, sizeof($\ast$(ptr)))}



Convenience macro for well known structures and types. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em ptr} & The pointer to free\\
\hline
\end{DoxyParams}
This is the same as \mbox{\hyperlink{group__Eina__FreeQ__Group_gafe655be65cbf4f01310c2147c22f2c92}{eina\+\_\+freeq\+\_\+ptr\+\_\+main\+\_\+add()}} but the free function is assumed to be the libc free() function, and size is provided by sizeof($\ast$ptr), so it will not work on void pointers or will be inaccurate for pointers to arrays. For arrays please use EINA\+\_\+\+FREEQ\+\_\+\+ARRAY\+\_\+\+FREE()

\begin{DoxySince}{Since}
1.\+19 
\end{DoxySince}
\mbox{\Hypertarget{group__Eina__FreeQ__Group_ga7997c740db6b46e562ff053b49912188}\label{group__Eina__FreeQ__Group_ga7997c740db6b46e562ff053b49912188}} 
\index{Free Queue Group@{Free Queue Group}!EINA\_FREEQ\_N\_FREE@{EINA\_FREEQ\_N\_FREE}}
\index{EINA\_FREEQ\_N\_FREE@{EINA\_FREEQ\_N\_FREE}!Free Queue Group@{Free Queue Group}}
\doxysubsubsection{\texorpdfstring{EINA\_FREEQ\_N\_FREE}{EINA\_FREEQ\_N\_FREE}}
{\footnotesize\ttfamily \#define EINA\+\_\+\+FREEQ\+\_\+\+N\+\_\+\+FREE(\begin{DoxyParamCaption}\item[{}]{ptr,  }\item[{}]{n }\end{DoxyParamCaption})~\mbox{\hyperlink{group__Eina__FreeQ__Group_gafe655be65cbf4f01310c2147c22f2c92}{eina\+\_\+freeq\+\_\+ptr\+\_\+main\+\_\+add}}(ptr, NULL, sizeof($\ast$(ptr)) $\ast$ n)}



Convenience macro for well known structures and types. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em ptr} & The pointer to free\\
\hline
\end{DoxyParams}
This is the same as \mbox{\hyperlink{group__Eina__FreeQ__Group_gafe655be65cbf4f01310c2147c22f2c92}{eina\+\_\+freeq\+\_\+ptr\+\_\+main\+\_\+add()}} but the free function is assumed to be the libc free() function, and size is provided by sizeof($\ast$ptr), so it will not work on void pointers. Total size is multiplied by the count {\ttfamily n} so it should work well for arrays of types.

\begin{DoxySince}{Since}
1.\+19 
\end{DoxySince}


\doxysubsection{Typedef Documentation}
\mbox{\Hypertarget{group__Eina__FreeQ__Group_gaa950e27974a73908ef81a2bb20cf94c7}\label{group__Eina__FreeQ__Group_gaa950e27974a73908ef81a2bb20cf94c7}} 
\index{Free Queue Group@{Free Queue Group}!Eina\_FreeQ@{Eina\_FreeQ}}
\index{Eina\_FreeQ@{Eina\_FreeQ}!Free Queue Group@{Free Queue Group}}
\doxysubsubsection{\texorpdfstring{Eina\_FreeQ}{Eina\_FreeQ}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__Eina__FreeQ__Group_gaa950e27974a73908ef81a2bb20cf94c7}{Eina\+\_\+\+FreeQ}}}



A queue of pointers to free in the future. 

You may create custom free queues of your own to defer freeing, use the main free queue where the mainloop will free things as it iterates, or eina will free everything on shut down. \mbox{\Hypertarget{group__Eina__FreeQ__Group_gadf7f65a475ab3d1e63214cfd3c9c4598}\label{group__Eina__FreeQ__Group_gadf7f65a475ab3d1e63214cfd3c9c4598}} 
\index{Free Queue Group@{Free Queue Group}!Eina\_FreeQ\_Type@{Eina\_FreeQ\_Type}}
\index{Eina\_FreeQ\_Type@{Eina\_FreeQ\_Type}!Free Queue Group@{Free Queue Group}}
\doxysubsubsection{\texorpdfstring{Eina\_FreeQ\_Type}{Eina\_FreeQ\_Type}}
{\footnotesize\ttfamily typedef enum \mbox{\hyperlink{group__Eina__FreeQ__Group_ga52c4eb7c091de64d45dc7a97c650eff4}{\+\_\+\+Eina\+\_\+\+Free\+Q\+\_\+\+Type}} \mbox{\hyperlink{group__Eina__FreeQ__Group_gadf7f65a475ab3d1e63214cfd3c9c4598}{Eina\+\_\+\+Free\+Q\+\_\+\+Type}}}



Type of free queues. 

\begin{DoxySince}{Since}
1.\+19 
\end{DoxySince}


\doxysubsection{Enumeration Type Documentation}
\mbox{\Hypertarget{group__Eina__FreeQ__Group_ga52c4eb7c091de64d45dc7a97c650eff4}\label{group__Eina__FreeQ__Group_ga52c4eb7c091de64d45dc7a97c650eff4}} 
\index{Free Queue Group@{Free Queue Group}!\_Eina\_FreeQ\_Type@{\_Eina\_FreeQ\_Type}}
\index{\_Eina\_FreeQ\_Type@{\_Eina\_FreeQ\_Type}!Free Queue Group@{Free Queue Group}}
\doxysubsubsection{\texorpdfstring{\_Eina\_FreeQ\_Type}{\_Eina\_FreeQ\_Type}}
{\footnotesize\ttfamily enum \mbox{\hyperlink{group__Eina__FreeQ__Group_ga52c4eb7c091de64d45dc7a97c650eff4}{\+\_\+\+Eina\+\_\+\+Free\+Q\+\_\+\+Type}}}



Type of free queues. 

\begin{DoxySince}{Since}
1.\+19 
\end{DoxySince}
\begin{DoxyEnumFields}{Enumerator}
\raisebox{\heightof{T}}[0pt][0pt]{\index{EINA\_FREEQ\_DEFAULT@{EINA\_FREEQ\_DEFAULT}!Free Queue Group@{Free Queue Group}}\index{Free Queue Group@{Free Queue Group}!EINA\_FREEQ\_DEFAULT@{EINA\_FREEQ\_DEFAULT}}}\mbox{\Hypertarget{group__Eina__FreeQ__Group_gga52c4eb7c091de64d45dc7a97c650eff4a38a3a01f7a20cb8102d7747998118372}\label{group__Eina__FreeQ__Group_gga52c4eb7c091de64d45dc7a97c650eff4a38a3a01f7a20cb8102d7747998118372}} 
EINA\+\_\+\+FREEQ\+\_\+\+DEFAULT&Default type of free queue. Default free queue, any object added to it should be considered freed immediately. Use this kind of freeq for debugging and additional memory safety purposes only.

As this type of free queue is thread-\/safe, the free functions used must also be thread-\/safe (e.\+g.. libc free()).

\begin{DoxySince}{Since}
1.\+19 
\end{DoxySince}
\\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{EINA\_FREEQ\_POSTPONED@{EINA\_FREEQ\_POSTPONED}!Free Queue Group@{Free Queue Group}}\index{Free Queue Group@{Free Queue Group}!EINA\_FREEQ\_POSTPONED@{EINA\_FREEQ\_POSTPONED}}}\mbox{\Hypertarget{group__Eina__FreeQ__Group_gga52c4eb7c091de64d45dc7a97c650eff4ad991b1175049f0befd977324e79e73cd}\label{group__Eina__FreeQ__Group_gga52c4eb7c091de64d45dc7a97c650eff4ad991b1175049f0befd977324e79e73cd}} 
EINA\+\_\+\+FREEQ\+\_\+\+POSTPONED&Postponed type of free queue. Postponed free queues behave differently in that objects added to it are not to be considered freed immediately, but rather they are short-\/lived. Use this to return temporary objects that may be used only in the local scope. The queued objects lifetime ends as soon as the execution comes back to the loop. Objects added to this kind of free queue should be accessed exclusively from the same thread that adds them.

If a thread does not have a loop attached, the application may leak all those objects. At the moment of writing this means only the main loop should use such a free queue.

By default those queues have no memory limit, and will be entirely flushed when the execution comes back to the loop.

This type of free queue is not thread-\/safe and should be considered local to a single thread.

\begin{DoxySince}{Since}
1.\+19 
\end{DoxySince}
\\
\hline

\end{DoxyEnumFields}


\doxysubsection{Function Documentation}
\mbox{\Hypertarget{group__Eina__FreeQ__Group_gaf5891e010bb750a3358dc2aca643cef8}\label{group__Eina__FreeQ__Group_gaf5891e010bb750a3358dc2aca643cef8}} 
\index{Free Queue Group@{Free Queue Group}!eina\_freeq\_new@{eina\_freeq\_new}}
\index{eina\_freeq\_new@{eina\_freeq\_new}!Free Queue Group@{Free Queue Group}}
\doxysubsubsection{\texorpdfstring{eina\_freeq\_new()}{eina\_freeq\_new()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__Eina__FreeQ__Group_gaa950e27974a73908ef81a2bb20cf94c7}{Eina\+\_\+\+FreeQ}}$\ast$ eina\+\_\+freeq\+\_\+new (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__Eina__FreeQ__Group_gadf7f65a475ab3d1e63214cfd3c9c4598}{Eina\+\_\+\+Free\+Q\+\_\+\+Type}}}]{type }\end{DoxyParamCaption})}



Create a new free queue to defer freeing of data with. 

\begin{DoxyReturn}{Returns}
A new free queue 
\end{DoxyReturn}
\begin{DoxySince}{Since}
1.\+19 
\end{DoxySince}


References EINA\+\_\+\+FREEQ\+\_\+\+DEFAULT, and EINA\+\_\+\+FREEQ\+\_\+\+POSTPONED.



Referenced by eina\+\_\+init(), and elm\+\_\+quicklaunch\+\_\+init().

\mbox{\Hypertarget{group__Eina__FreeQ__Group_gaa39f5a69f7f82354fa4bdecf0e1c1f6b}\label{group__Eina__FreeQ__Group_gaa39f5a69f7f82354fa4bdecf0e1c1f6b}} 
\index{Free Queue Group@{Free Queue Group}!eina\_freeq\_free@{eina\_freeq\_free}}
\index{eina\_freeq\_free@{eina\_freeq\_free}!Free Queue Group@{Free Queue Group}}
\doxysubsubsection{\texorpdfstring{eina\_freeq\_free()}{eina\_freeq\_free()}}
{\footnotesize\ttfamily void eina\+\_\+freeq\+\_\+free (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__Eina__FreeQ__Group_gaa950e27974a73908ef81a2bb20cf94c7}{Eina\+\_\+\+FreeQ}} $\ast$}]{fq }\end{DoxyParamCaption})}



Free a free queue and anything that is queued in it. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in,out}}  & {\em fq} & The free queue to free and clear.\\
\hline
\end{DoxyParams}
\begin{DoxySince}{Since}
1.\+19 
\end{DoxySince}


References eina\+\_\+freeq\+\_\+clear(), and eina\+\_\+lock\+\_\+free().



Referenced by eina\+\_\+shutdown().

\mbox{\Hypertarget{group__Eina__FreeQ__Group_ga5ea1e76adbb4a2ba39e40663ab1c65ba}\label{group__Eina__FreeQ__Group_ga5ea1e76adbb4a2ba39e40663ab1c65ba}} 
\index{Free Queue Group@{Free Queue Group}!eina\_freeq\_type\_get@{eina\_freeq\_type\_get}}
\index{eina\_freeq\_type\_get@{eina\_freeq\_type\_get}!Free Queue Group@{Free Queue Group}}
\doxysubsubsection{\texorpdfstring{eina\_freeq\_type\_get()}{eina\_freeq\_type\_get()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__Eina__FreeQ__Group_gadf7f65a475ab3d1e63214cfd3c9c4598}{Eina\+\_\+\+Free\+Q\+\_\+\+Type}} eina\+\_\+freeq\+\_\+type\+\_\+get (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__Eina__FreeQ__Group_gaa950e27974a73908ef81a2bb20cf94c7}{Eina\+\_\+\+FreeQ}} $\ast$}]{fq }\end{DoxyParamCaption})}



Query the type of a free queue. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em fq} & The free queue to inspect.\\
\hline
\end{DoxyParams}
\begin{DoxySince}{Since}
1.\+19 
\end{DoxySince}


References EINA\+\_\+\+FREEQ\+\_\+\+DEFAULT, and EINA\+\_\+\+FREEQ\+\_\+\+POSTPONED.

\mbox{\Hypertarget{group__Eina__FreeQ__Group_ga11585a5f2b77a18bcb87b0587e91953d}\label{group__Eina__FreeQ__Group_ga11585a5f2b77a18bcb87b0587e91953d}} 
\index{Free Queue Group@{Free Queue Group}!eina\_freeq\_main\_get@{eina\_freeq\_main\_get}}
\index{eina\_freeq\_main\_get@{eina\_freeq\_main\_get}!Free Queue Group@{Free Queue Group}}
\doxysubsubsection{\texorpdfstring{eina\_freeq\_main\_get()}{eina\_freeq\_main\_get()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__Eina__FreeQ__Group_gaa950e27974a73908ef81a2bb20cf94c7}{Eina\+\_\+\+FreeQ}}$\ast$ eina\+\_\+freeq\+\_\+main\+\_\+get (\begin{DoxyParamCaption}\item[{void}]{ }\end{DoxyParamCaption})}



Get the main loop free queue. 

\begin{DoxyReturn}{Returns}
The main loop free queue.
\end{DoxyReturn}
\begin{DoxySince}{Since}
1.\+19 
\end{DoxySince}


Referenced by eina\+\_\+freeq\+\_\+ptr\+\_\+main\+\_\+add(), and eina\+\_\+shutdown().

\mbox{\Hypertarget{group__Eina__FreeQ__Group_ga0c150fcdb735d20ca6555aaa7bb79e5d}\label{group__Eina__FreeQ__Group_ga0c150fcdb735d20ca6555aaa7bb79e5d}} 
\index{Free Queue Group@{Free Queue Group}!eina\_freeq\_count\_max\_set@{eina\_freeq\_count\_max\_set}}
\index{eina\_freeq\_count\_max\_set@{eina\_freeq\_count\_max\_set}!Free Queue Group@{Free Queue Group}}
\doxysubsubsection{\texorpdfstring{eina\_freeq\_count\_max\_set()}{eina\_freeq\_count\_max\_set()}}
{\footnotesize\ttfamily void eina\+\_\+freeq\+\_\+count\+\_\+max\+\_\+set (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__Eina__FreeQ__Group_gaa950e27974a73908ef81a2bb20cf94c7}{Eina\+\_\+\+FreeQ}} $\ast$}]{fq,  }\item[{int}]{count }\end{DoxyParamCaption})}



Set the maximum number of free pointers this queue is allowed. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in,out}}  & {\em fq} & The free queue to alter \\
\hline
\mbox{\texttt{ in}}  & {\em count} & The maximum number of items allowed, negative values mean no limit\\
\hline
\end{DoxyParams}
This will alter the maximum number of pointers allowed in the given free queue. If more items are added to the free queue than are allowed, excess items will be freed to make room for the new items. If count is changed, then excess items may be cleaned out at the time this API is called.

\begin{DoxyNote}{Note}
Setting a maximum count on a postponed free queue leads to undefined behavior.
\end{DoxyNote}
\begin{DoxySince}{Since}
1.\+19 
\end{DoxySince}
\mbox{\Hypertarget{group__Eina__FreeQ__Group_gaa5920dadcc29e1fea9a5acaed59da0a6}\label{group__Eina__FreeQ__Group_gaa5920dadcc29e1fea9a5acaed59da0a6}} 
\index{Free Queue Group@{Free Queue Group}!eina\_freeq\_count\_max\_get@{eina\_freeq\_count\_max\_get}}
\index{eina\_freeq\_count\_max\_get@{eina\_freeq\_count\_max\_get}!Free Queue Group@{Free Queue Group}}
\doxysubsubsection{\texorpdfstring{eina\_freeq\_count\_max\_get()}{eina\_freeq\_count\_max\_get()}}
{\footnotesize\ttfamily int eina\+\_\+freeq\+\_\+count\+\_\+max\+\_\+get (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__Eina__FreeQ__Group_gaa950e27974a73908ef81a2bb20cf94c7}{Eina\+\_\+\+FreeQ}} $\ast$}]{fq }\end{DoxyParamCaption})}



Get the maximum number of free pointers this queue is allowed. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em fq} & The free queue to query \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The maximum number of free items allowed or -\/1 for infinity
\end{DoxyReturn}
\begin{DoxySince}{Since}
1.\+19 
\end{DoxySince}
\mbox{\Hypertarget{group__Eina__FreeQ__Group_ga38653956652a03774810b270b0899379}\label{group__Eina__FreeQ__Group_ga38653956652a03774810b270b0899379}} 
\index{Free Queue Group@{Free Queue Group}!eina\_freeq\_mem\_max\_set@{eina\_freeq\_mem\_max\_set}}
\index{eina\_freeq\_mem\_max\_set@{eina\_freeq\_mem\_max\_set}!Free Queue Group@{Free Queue Group}}
\doxysubsubsection{\texorpdfstring{eina\_freeq\_mem\_max\_set()}{eina\_freeq\_mem\_max\_set()}}
{\footnotesize\ttfamily void eina\+\_\+freeq\+\_\+mem\+\_\+max\+\_\+set (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__Eina__FreeQ__Group_gaa950e27974a73908ef81a2bb20cf94c7}{Eina\+\_\+\+FreeQ}} $\ast$}]{fq,  }\item[{size\+\_\+t}]{mem }\end{DoxyParamCaption})}



Set the maximum amount of memory allowed. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in,out}}  & {\em fq} & The free queue to alter \\
\hline
\mbox{\texttt{ in}}  & {\em mem} & The maximum memory in bytes\\
\hline
\end{DoxyParams}
This will alter the maximum amount of memory allowed for pointers stored in the free queue. The size used is the size give, so items given that are 0 sized will not contribute to this limit. If items with a total memory footprint are added to the free queue, items will be cleaned out until the total is below this limit. Changing the limit may involve cleaning out excess items from the free queue until the total amount of memory used by items in the queue is below or at the limit.

\begin{DoxyNote}{Note}
Setting a memory limit on a postponed free queue leads to undefined behavior.
\end{DoxyNote}
\begin{DoxySince}{Since}
1.\+19 
\end{DoxySince}
\mbox{\Hypertarget{group__Eina__FreeQ__Group_ga1e93189eb3c2ee682ccef085639a6d58}\label{group__Eina__FreeQ__Group_ga1e93189eb3c2ee682ccef085639a6d58}} 
\index{Free Queue Group@{Free Queue Group}!eina\_freeq\_mem\_max\_get@{eina\_freeq\_mem\_max\_get}}
\index{eina\_freeq\_mem\_max\_get@{eina\_freeq\_mem\_max\_get}!Free Queue Group@{Free Queue Group}}
\doxysubsubsection{\texorpdfstring{eina\_freeq\_mem\_max\_get()}{eina\_freeq\_mem\_max\_get()}}
{\footnotesize\ttfamily size\+\_\+t eina\+\_\+freeq\+\_\+mem\+\_\+max\+\_\+get (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__Eina__FreeQ__Group_gaa950e27974a73908ef81a2bb20cf94c7}{Eina\+\_\+\+FreeQ}} $\ast$}]{fq }\end{DoxyParamCaption})}



Get the maximum amount of memory allowed. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em fq} & The free queue to query \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The maximum amount of memory in bytes
\end{DoxyReturn}
\begin{DoxySince}{Since}
1.\+19 
\end{DoxySince}
\mbox{\Hypertarget{group__Eina__FreeQ__Group_ga979bb6163af485dc8c0199cddbfc2e1b}\label{group__Eina__FreeQ__Group_ga979bb6163af485dc8c0199cddbfc2e1b}} 
\index{Free Queue Group@{Free Queue Group}!eina\_freeq\_clear@{eina\_freeq\_clear}}
\index{eina\_freeq\_clear@{eina\_freeq\_clear}!Free Queue Group@{Free Queue Group}}
\doxysubsubsection{\texorpdfstring{eina\_freeq\_clear()}{eina\_freeq\_clear()}}
{\footnotesize\ttfamily void eina\+\_\+freeq\+\_\+clear (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__Eina__FreeQ__Group_gaa950e27974a73908ef81a2bb20cf94c7}{Eina\+\_\+\+FreeQ}} $\ast$}]{fq }\end{DoxyParamCaption})}



Clear out all queued items to be freed by freeing them. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in,out}}  & {\em fq} & The free queue to clear\\
\hline
\end{DoxyParams}
This will free and thus remove all queued items from the free queue when this function is called. When it returns the free queue should be empty.

\begin{DoxySince}{Since}
1.\+19 
\end{DoxySince}


Referenced by eina\+\_\+freeq\+\_\+free().

\mbox{\Hypertarget{group__Eina__FreeQ__Group_ga6b79c51d50fb5a0feb77ca225be2ccee}\label{group__Eina__FreeQ__Group_ga6b79c51d50fb5a0feb77ca225be2ccee}} 
\index{Free Queue Group@{Free Queue Group}!eina\_freeq\_reduce@{eina\_freeq\_reduce}}
\index{eina\_freeq\_reduce@{eina\_freeq\_reduce}!Free Queue Group@{Free Queue Group}}
\doxysubsubsection{\texorpdfstring{eina\_freeq\_reduce()}{eina\_freeq\_reduce()}}
{\footnotesize\ttfamily void eina\+\_\+freeq\+\_\+reduce (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__Eina__FreeQ__Group_gaa950e27974a73908ef81a2bb20cf94c7}{Eina\+\_\+\+FreeQ}} $\ast$}]{fq,  }\item[{int}]{count }\end{DoxyParamCaption})}



Reduce the number of items in the free queue by up to {\ttfamily count}. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in,out}}  & {\em fq} & The free queue to reduce in item count \\
\hline
\mbox{\texttt{ in}}  & {\em count} & The number of items to try and free\\
\hline
\end{DoxyParams}
This will attempt to free up to {\ttfamily count} items from the given free queue and thus reduce the amount of memory it is holding on to. This function will return once it has removed {\ttfamily count} items or there are no more items to remove from the queue.

\begin{DoxySince}{Since}
1.\+19 
\end{DoxySince}
\mbox{\Hypertarget{group__Eina__FreeQ__Group_ga3a5d2d5c564ca0da39400bfcedc77185}\label{group__Eina__FreeQ__Group_ga3a5d2d5c564ca0da39400bfcedc77185}} 
\index{Free Queue Group@{Free Queue Group}!eina\_freeq\_ptr\_pending@{eina\_freeq\_ptr\_pending}}
\index{eina\_freeq\_ptr\_pending@{eina\_freeq\_ptr\_pending}!Free Queue Group@{Free Queue Group}}
\doxysubsubsection{\texorpdfstring{eina\_freeq\_ptr\_pending()}{eina\_freeq\_ptr\_pending()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\+\_\+\+Bool}} eina\+\_\+freeq\+\_\+ptr\+\_\+pending (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__Eina__FreeQ__Group_gaa950e27974a73908ef81a2bb20cf94c7}{Eina\+\_\+\+FreeQ}} $\ast$}]{fq }\end{DoxyParamCaption})}



Return if there are any items pending a free in the free queue. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em fq} & The free queue to query \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
EINA\+\_\+\+TRUE if there are items to free, EINA\+\_\+\+FALSE otherwise
\end{DoxyReturn}
\begin{DoxySince}{Since}
1.\+19 
\end{DoxySince}
\mbox{\Hypertarget{group__Eina__FreeQ__Group_gaacfa4ac2eee628ec39fdbeac7d5f7ad2}\label{group__Eina__FreeQ__Group_gaacfa4ac2eee628ec39fdbeac7d5f7ad2}} 
\index{Free Queue Group@{Free Queue Group}!eina\_freeq\_ptr\_add@{eina\_freeq\_ptr\_add}}
\index{eina\_freeq\_ptr\_add@{eina\_freeq\_ptr\_add}!Free Queue Group@{Free Queue Group}}
\doxysubsubsection{\texorpdfstring{eina\_freeq\_ptr\_add()}{eina\_freeq\_ptr\_add()}}
{\footnotesize\ttfamily void eina\+\_\+freeq\+\_\+ptr\+\_\+add (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__Eina__FreeQ__Group_gaa950e27974a73908ef81a2bb20cf94c7}{Eina\+\_\+\+FreeQ}} $\ast$}]{fq,  }\item[{void $\ast$}]{ptr,  }\item[{void($\ast$)(void $\ast$ptr)}]{free\+\_\+func,  }\item[{size\+\_\+t}]{size }\end{DoxyParamCaption})}



Add a pointer with free function and size to the free queue. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in,out}}  & {\em fq} & The free queue to add the pointer to \\
\hline
\mbox{\texttt{ in}}  & {\em ptr} & The pointer to free \\
\hline
\mbox{\texttt{ in}}  & {\em free\+\_\+func} & The function used to free the pointer with \\
\hline
\mbox{\texttt{ in}}  & {\em size} & The size of the data the pointer points to\\
\hline
\end{DoxyParams}
This adds the given {\ttfamily ptr} pointer to the queue to be freed later on. The function {\ttfamily free\+\_\+func} will be used, or if this is NULL, it is assumed the libc free() function will be used then instead. The {\ttfamily size} parameter determines the size of the data pointed to, but if this is 0 then no assumptions are made about size and the pointer is considered opaque. A zero sized pointer will not contribute to the total memory usage of items in the queue as well. If {\ttfamily size} is supplied it must be correct as the memory may be written to for debugging purposes or otherwise inspected or checksummed. Once a pointer is added to the free queue with this API the memory should be considered freed as if the real {\ttfamily free\+\_\+func} was called immediately (and it may actually be called immediately if certain environment variables are set). A free queue exists to move the cost of freeing to another point in time when it is more convenient to do so as well as provide some robustness for badly written code that may access memory after freeing. Note that when using tools like valgrind, eina detects this and will also immediately free the data so valgrind\textquotesingle{}s own memory checkers can detect use after free as normal.

Note\+: The free function must not access the CONTENT of the memory to be freed, or at least consider it invalid and full of garbage. It is already invalid at the moment it is added to the free queue. Just the actual free function may be delayed. The free function may also not access other memory already freed before being added to the free queue. They may do tricks like use memory headers that are outside the memory region to be freed (pass in pointer char $\ast$x, then char $\ast$header\+\_\+address = x -\/ 16 to get header information) as this header is not considered part of the free data. This note does not apply if you use a size of 0 for the pointer, but then you lose canary debugging ability when using 0 sized pointers on the free queue.

\begin{DoxySince}{Since}
1.\+19 
\end{DoxySince}


References EINA\+\_\+\+LOG\+\_\+\+ERR.



Referenced by eina\+\_\+freeq\+\_\+ptr\+\_\+main\+\_\+add().

\mbox{\Hypertarget{group__Eina__FreeQ__Group_gafe655be65cbf4f01310c2147c22f2c92}\label{group__Eina__FreeQ__Group_gafe655be65cbf4f01310c2147c22f2c92}} 
\index{Free Queue Group@{Free Queue Group}!eina\_freeq\_ptr\_main\_add@{eina\_freeq\_ptr\_main\_add}}
\index{eina\_freeq\_ptr\_main\_add@{eina\_freeq\_ptr\_main\_add}!Free Queue Group@{Free Queue Group}}
\doxysubsubsection{\texorpdfstring{eina\_freeq\_ptr\_main\_add()}{eina\_freeq\_ptr\_main\_add()}}
{\footnotesize\ttfamily static void eina\+\_\+freeq\+\_\+ptr\+\_\+main\+\_\+add (\begin{DoxyParamCaption}\item[{void $\ast$}]{ptr,  }\item[{void($\ast$)(void $\ast$ptr)}]{free\+\_\+func,  }\item[{size\+\_\+t}]{size }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



Add a pointer to the main free queue. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em ptr} & The pointer to free \\
\hline
\mbox{\texttt{ in}}  & {\em free\+\_\+func} & The function used to free the pointer with \\
\hline
\mbox{\texttt{ in}}  & {\em size} & The size of the data the pointer points to\\
\hline
\end{DoxyParams}
This is the same as \mbox{\hyperlink{group__Eina__FreeQ__Group_gaacfa4ac2eee628ec39fdbeac7d5f7ad2}{eina\+\_\+freeq\+\_\+ptr\+\_\+add()}} but the main free queue is fetched by \mbox{\hyperlink{group__Eina__FreeQ__Group_ga11585a5f2b77a18bcb87b0587e91953d}{eina\+\_\+freeq\+\_\+main\+\_\+get()}}.

\begin{DoxySince}{Since}
1.\+19 
\end{DoxySince}


References eina\+\_\+freeq\+\_\+main\+\_\+get(), and eina\+\_\+freeq\+\_\+ptr\+\_\+add().

