\hypertarget{allocator__bucket__alloc_8h}{\section{ompi/mca/allocator/bucket/allocator\+\_\+bucket\+\_\+alloc.h File Reference}
\label{allocator__bucket__alloc_8h}\index{ompi/mca/allocator/bucket/allocator\+\_\+bucket\+\_\+alloc.\+h@{ompi/mca/allocator/bucket/allocator\+\_\+bucket\+\_\+alloc.\+h}}
}


Copyright (c) 2004-\/2005 The Trustees of Indiana University and Indiana University Research and Technology Corporation.  


{\ttfamily \#include \char`\"{}ompi\+\_\+config.\+h\char`\"{}}\\*
{\ttfamily \#include $<$stdlib.\+h$>$}\\*
{\ttfamily \#include $<$string.\+h$>$}\\*
{\ttfamily \#include \char`\"{}opal/threads/mutex.\+h\char`\"{}}\\*
{\ttfamily \#include \char`\"{}ompi/mca/allocator/allocator.\+h\char`\"{}}\\*
\subsection*{Data Structures}
\begin{DoxyCompactItemize}
\item 
struct \hyperlink{structmca__allocator__bucket__chunk__header__t}{mca\+\_\+allocator\+\_\+bucket\+\_\+chunk\+\_\+header\+\_\+t}
\begin{DoxyCompactList}\small\item\em Structure for the header of each memory chunk. \end{DoxyCompactList}\item 
union \hyperlink{unionmca__allocator__bucket__chunk__header__t_1_1u}{mca\+\_\+allocator\+\_\+bucket\+\_\+chunk\+\_\+header\+\_\+t\+::u}
\begin{DoxyCompactList}\small\item\em Union which holds either a pointer to the next free chunk or the bucket number. \end{DoxyCompactList}\item 
struct \hyperlink{structmca__allocator__bucket__segment__head__t}{mca\+\_\+allocator\+\_\+bucket\+\_\+segment\+\_\+head\+\_\+t}
\begin{DoxyCompactList}\small\item\em Structure that heads each segment. \end{DoxyCompactList}\item 
struct \hyperlink{structmca__allocator__bucket__bucket__t}{mca\+\_\+allocator\+\_\+bucket\+\_\+bucket\+\_\+t}
\begin{DoxyCompactList}\small\item\em Structure for each bucket. \end{DoxyCompactList}\item 
struct \hyperlink{structmca__allocator__bucket__t}{mca\+\_\+allocator\+\_\+bucket\+\_\+t}
\begin{DoxyCompactList}\small\item\em Structure that holds the necessary information for each area of memory. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Typedefs}
\begin{DoxyCompactItemize}
\item 
\hypertarget{allocator__bucket__alloc_8h_af78378851f6863de41024fbdd126cd5c}{typedef struct \\*
\hyperlink{structmca__allocator__bucket__chunk__header__t}{mca\+\_\+allocator\+\_\+bucket\+\_\+chunk\+\_\+header\+\_\+t} \hyperlink{allocator__bucket__alloc_8h_af78378851f6863de41024fbdd126cd5c}{mca\+\_\+allocator\+\_\+bucket\+\_\+chunk\+\_\+header\+\_\+t}}\label{allocator__bucket__alloc_8h_af78378851f6863de41024fbdd126cd5c}

\begin{DoxyCompactList}\small\item\em Typedef so we don't have to use struct. \end{DoxyCompactList}\item 
\hypertarget{allocator__bucket__alloc_8h_a49db275b0717c20cefd50d9751a9ac80}{typedef struct \\*
\hyperlink{structmca__allocator__bucket__segment__head__t}{mca\+\_\+allocator\+\_\+bucket\+\_\+segment\+\_\+head\+\_\+t} \hyperlink{allocator__bucket__alloc_8h_a49db275b0717c20cefd50d9751a9ac80}{mca\+\_\+allocator\+\_\+bucket\+\_\+segment\+\_\+head\+\_\+t}}\label{allocator__bucket__alloc_8h_a49db275b0717c20cefd50d9751a9ac80}

\begin{DoxyCompactList}\small\item\em Typedef so we don't have to use struct. \end{DoxyCompactList}\item 
\hypertarget{allocator__bucket__alloc_8h_a423b8136533c0ab2fb91f9f016afaf5e}{typedef struct \\*
\hyperlink{structmca__allocator__bucket__bucket__t}{mca\+\_\+allocator\+\_\+bucket\+\_\+bucket\+\_\+t} \hyperlink{allocator__bucket__alloc_8h_a423b8136533c0ab2fb91f9f016afaf5e}{mca\+\_\+allocator\+\_\+bucket\+\_\+bucket\+\_\+t}}\label{allocator__bucket__alloc_8h_a423b8136533c0ab2fb91f9f016afaf5e}

\begin{DoxyCompactList}\small\item\em Typedef so we don't have to use struct. \end{DoxyCompactList}\item 
\hypertarget{allocator__bucket__alloc_8h_ad40dea7939c37ef7a0347c328e132e40}{typedef struct \\*
\hyperlink{structmca__allocator__bucket__t}{mca\+\_\+allocator\+\_\+bucket\+\_\+t} \hyperlink{allocator__bucket__alloc_8h_ad40dea7939c37ef7a0347c328e132e40}{mca\+\_\+allocator\+\_\+bucket\+\_\+t}}\label{allocator__bucket__alloc_8h_ad40dea7939c37ef7a0347c328e132e40}

\begin{DoxyCompactList}\small\item\em Typedef so we don't have to use struct. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
\hyperlink{structmca__allocator__bucket__t}{mca\+\_\+allocator\+\_\+bucket\+\_\+t} $\ast$ \hyperlink{allocator__bucket__alloc_8h_aaec791259b8da050da0358f377552b36}{mca\+\_\+allocator\+\_\+bucket\+\_\+init} (\hyperlink{structmca__allocator__base__module__t}{mca\+\_\+allocator\+\_\+base\+\_\+module\+\_\+t} $\ast$mem, int num\+\_\+buckets, \hyperlink{allocator_8h_a5472d80a69d79779b45fe4d01276ff6c}{mca\+\_\+allocator\+\_\+base\+\_\+component\+\_\+segment\+\_\+alloc\+\_\+fn\+\_\+t} get\+\_\+mem\+\_\+funct, \hyperlink{allocator_8h_a33e0a8ba4ad4dd42764679363fa38faf}{mca\+\_\+allocator\+\_\+base\+\_\+component\+\_\+segment\+\_\+free\+\_\+fn\+\_\+t} free\+\_\+mem\+\_\+funct)
\begin{DoxyCompactList}\small\item\em Initializes the mca\+\_\+allocator\+\_\+bucket\+\_\+options\+\_\+t data structure for the passed parameters. \end{DoxyCompactList}\item 
void $\ast$ \hyperlink{allocator__bucket__alloc_8h_a7a57c171f9248cd4d78cdcb6010c2d28}{mca\+\_\+allocator\+\_\+bucket\+\_\+alloc} (\hyperlink{structmca__allocator__base__module__t}{mca\+\_\+allocator\+\_\+base\+\_\+module\+\_\+t} $\ast$mem, size\+\_\+t size, \hyperlink{structmca__mpool__base__registration__t}{mca\+\_\+mpool\+\_\+base\+\_\+registration\+\_\+t} $\ast$$\ast$registration)
\begin{DoxyCompactList}\small\item\em Accepts a request for memory in a specific region defined by the mca\+\_\+allocator\+\_\+bucket\+\_\+options\+\_\+t struct and returns a pointer to memory in that region or N\+U\+L\+L if there was an error. \end{DoxyCompactList}\item 
void $\ast$ \hyperlink{allocator__bucket__alloc_8h_ade0735ae1959f602c33cd0b49bcfe850}{mca\+\_\+allocator\+\_\+bucket\+\_\+alloc\+\_\+align} (\hyperlink{structmca__allocator__base__module__t}{mca\+\_\+allocator\+\_\+base\+\_\+module\+\_\+t} $\ast$mem, size\+\_\+t size, size\+\_\+t alignment, \hyperlink{structmca__mpool__base__registration__t}{mca\+\_\+mpool\+\_\+base\+\_\+registration\+\_\+t} $\ast$$\ast$registration)
\begin{DoxyCompactList}\small\item\em Accepts a request for memory in a specific region defined by the mca\+\_\+allocator\+\_\+bucket\+\_\+options\+\_\+t struct and aligned by the specified amount and returns a pointer to memory in that region or N\+U\+L\+L if there was an error. \end{DoxyCompactList}\item 
void $\ast$ \hyperlink{allocator__bucket__alloc_8h_a788dca8f9a8a51ea97f455b041829f5c}{mca\+\_\+allocator\+\_\+bucket\+\_\+realloc} (\hyperlink{structmca__allocator__base__module__t}{mca\+\_\+allocator\+\_\+base\+\_\+module\+\_\+t} $\ast$mem, void $\ast$ptr, size\+\_\+t size, \hyperlink{structmca__mpool__base__registration__t}{mca\+\_\+mpool\+\_\+base\+\_\+registration\+\_\+t} $\ast$$\ast$registration)
\begin{DoxyCompactList}\small\item\em Attempts to resize the passed region of memory into a larger or a smaller region. \end{DoxyCompactList}\item 
void \hyperlink{allocator__bucket__alloc_8h_aaed5641d1b04e39455a9a65296da8225}{mca\+\_\+allocator\+\_\+bucket\+\_\+free} (\hyperlink{structmca__allocator__base__module__t}{mca\+\_\+allocator\+\_\+base\+\_\+module\+\_\+t} $\ast$mem, void $\ast$ptr)
\begin{DoxyCompactList}\small\item\em Frees the passed region of memory. \end{DoxyCompactList}\item 
int \hyperlink{allocator__bucket__alloc_8h_af7a4706798db515d759099dc47ebd41c}{mca\+\_\+allocator\+\_\+bucket\+\_\+cleanup} (\hyperlink{structmca__allocator__base__module__t}{mca\+\_\+allocator\+\_\+base\+\_\+module\+\_\+t} $\ast$mem)
\begin{DoxyCompactList}\small\item\em Frees all the memory from all the buckets back to the system. \end{DoxyCompactList}\item 
int \hyperlink{allocator__bucket__alloc_8h_ab722dfbeed8509a826b3ce5435f28e38}{mca\+\_\+allocator\+\_\+bucket\+\_\+finalize} (\hyperlink{structmca__allocator__base__module__t}{mca\+\_\+allocator\+\_\+base\+\_\+module\+\_\+t} $\ast$mem)
\begin{DoxyCompactList}\small\item\em Cleanup all resources held by this allocator. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Variables}
\begin{DoxyCompactItemize}
\item 
\hypertarget{allocator__bucket__alloc_8h_a1a19ecde368d752667c9d8841a823aa4}{O\+M\+P\+I\+\_\+\+D\+E\+C\+L\+S\+P\+E\+C \\*
\hyperlink{allocator_8h_adba0f37f8491efef97cc54cc69966bb8}{mca\+\_\+allocator\+\_\+base\+\_\+component\+\_\+t} {\bfseries mca\+\_\+allocator\+\_\+bucket\+\_\+component}}\label{allocator__bucket__alloc_8h_a1a19ecde368d752667c9d8841a823aa4}

\end{DoxyCompactItemize}


\subsection{Detailed Description}
Copyright (c) 2004-\/2005 The Trustees of Indiana University and Indiana University Research and Technology Corporation. 

All rights reserved. Copyright (c) 2004-\/2005 The University of Tennessee and The University of Tennessee Research Foundation. All rights reserved. Copyright (c) 2004-\/2005 High Performance Computing Center Stuttgart, University of Stuttgart. All rights reserved. Copyright (c) 2004-\/2005 The Regents of the University of California. All rights reserved. \$\+C\+O\+P\+Y\+R\+I\+G\+H\+T\$

Additional copyrights may follow

\$\+H\+E\+A\+D\+E\+R\$ A generic memory bucket allocator. 

\subsection{Function Documentation}
\hypertarget{allocator__bucket__alloc_8h_a7a57c171f9248cd4d78cdcb6010c2d28}{\index{allocator\+\_\+bucket\+\_\+alloc.\+h@{allocator\+\_\+bucket\+\_\+alloc.\+h}!mca\+\_\+allocator\+\_\+bucket\+\_\+alloc@{mca\+\_\+allocator\+\_\+bucket\+\_\+alloc}}
\index{mca\+\_\+allocator\+\_\+bucket\+\_\+alloc@{mca\+\_\+allocator\+\_\+bucket\+\_\+alloc}!allocator\+\_\+bucket\+\_\+alloc.\+h@{allocator\+\_\+bucket\+\_\+alloc.\+h}}
\subsubsection[{mca\+\_\+allocator\+\_\+bucket\+\_\+alloc}]{\setlength{\rightskip}{0pt plus 5cm}void$\ast$ mca\+\_\+allocator\+\_\+bucket\+\_\+alloc (
\begin{DoxyParamCaption}
\item[{{\bf mca\+\_\+allocator\+\_\+base\+\_\+module\+\_\+t} $\ast$}]{mem, }
\item[{size\+\_\+t}]{size, }
\item[{{\bf mca\+\_\+mpool\+\_\+base\+\_\+registration\+\_\+t} $\ast$$\ast$}]{registration}
\end{DoxyParamCaption}
)}}\label{allocator__bucket__alloc_8h_a7a57c171f9248cd4d78cdcb6010c2d28}


Accepts a request for memory in a specific region defined by the mca\+\_\+allocator\+\_\+bucket\+\_\+options\+\_\+t struct and returns a pointer to memory in that region or N\+U\+L\+L if there was an error. 


\begin{DoxyParams}{Parameters}
{\em mem} & A pointer to the appropriate struct for the area of memory. \\
\hline
{\em size} & The size of the requested area of memory\\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Return values}
{\em Pointer} & to the area of memory if the allocation was successful \\
\hline
{\em N\+U\+L\+L} & if the allocation was unsuccessful \\
\hline
\end{DoxyRetVals}


References mca\+\_\+allocator\+\_\+bucket\+\_\+chunk\+\_\+header\+\_\+t\+::u\+::bucket, mca\+\_\+allocator\+\_\+bucket\+\_\+t\+::buckets, mca\+\_\+allocator\+\_\+bucket\+\_\+segment\+\_\+head\+\_\+t\+::first\+\_\+chunk, mca\+\_\+allocator\+\_\+bucket\+\_\+bucket\+\_\+t\+::free\+\_\+chunk, mca\+\_\+allocator\+\_\+bucket\+\_\+t\+::get\+\_\+mem\+\_\+fn, mca\+\_\+allocator\+\_\+bucket\+\_\+bucket\+\_\+t\+::lock, mca\+\_\+allocator\+\_\+bucket\+\_\+chunk\+\_\+header\+\_\+t\+::u\+::next\+\_\+free, mca\+\_\+allocator\+\_\+bucket\+\_\+chunk\+\_\+header\+\_\+t\+::next\+\_\+in\+\_\+segment, mca\+\_\+allocator\+\_\+bucket\+\_\+segment\+\_\+head\+\_\+t\+::next\+\_\+segment, O\+P\+A\+L\+\_\+\+T\+H\+R\+E\+A\+D\+\_\+\+L\+O\+C\+K, O\+P\+A\+L\+\_\+\+T\+H\+R\+E\+A\+D\+\_\+\+U\+N\+L\+O\+C\+K, mca\+\_\+allocator\+\_\+bucket\+\_\+bucket\+\_\+t\+::segment\+\_\+head, mca\+\_\+allocator\+\_\+bucket\+\_\+t\+::super, and mca\+\_\+allocator\+\_\+bucket\+\_\+chunk\+\_\+header\+\_\+t\+::u.



Referenced by mca\+\_\+allocator\+\_\+bucket\+\_\+realloc().

\hypertarget{allocator__bucket__alloc_8h_ade0735ae1959f602c33cd0b49bcfe850}{\index{allocator\+\_\+bucket\+\_\+alloc.\+h@{allocator\+\_\+bucket\+\_\+alloc.\+h}!mca\+\_\+allocator\+\_\+bucket\+\_\+alloc\+\_\+align@{mca\+\_\+allocator\+\_\+bucket\+\_\+alloc\+\_\+align}}
\index{mca\+\_\+allocator\+\_\+bucket\+\_\+alloc\+\_\+align@{mca\+\_\+allocator\+\_\+bucket\+\_\+alloc\+\_\+align}!allocator\+\_\+bucket\+\_\+alloc.\+h@{allocator\+\_\+bucket\+\_\+alloc.\+h}}
\subsubsection[{mca\+\_\+allocator\+\_\+bucket\+\_\+alloc\+\_\+align}]{\setlength{\rightskip}{0pt plus 5cm}void$\ast$ mca\+\_\+allocator\+\_\+bucket\+\_\+alloc\+\_\+align (
\begin{DoxyParamCaption}
\item[{{\bf mca\+\_\+allocator\+\_\+base\+\_\+module\+\_\+t} $\ast$}]{mem, }
\item[{size\+\_\+t}]{size, }
\item[{size\+\_\+t}]{alignment, }
\item[{{\bf mca\+\_\+mpool\+\_\+base\+\_\+registration\+\_\+t} $\ast$$\ast$}]{registration}
\end{DoxyParamCaption}
)}}\label{allocator__bucket__alloc_8h_ade0735ae1959f602c33cd0b49bcfe850}


Accepts a request for memory in a specific region defined by the mca\+\_\+allocator\+\_\+bucket\+\_\+options\+\_\+t struct and aligned by the specified amount and returns a pointer to memory in that region or N\+U\+L\+L if there was an error. 


\begin{DoxyParams}{Parameters}
{\em mem} & A pointer to the appropriate struct for the area of memory. \\
\hline
{\em size} & The size of the requested area of memory \\
\hline
{\em alignment} & The requested alignment of the new area of memory. This M\+U\+S\+T be a power of 2.\\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Return values}
{\em Pointer} & to the area of memory if the allocation was successful \\
\hline
{\em N\+U\+L\+L} & if the allocation was unsuccessful \\
\hline
\end{DoxyRetVals}


References mca\+\_\+allocator\+\_\+bucket\+\_\+chunk\+\_\+header\+\_\+t\+::u\+::bucket, mca\+\_\+allocator\+\_\+bucket\+\_\+t\+::buckets, mca\+\_\+allocator\+\_\+bucket\+\_\+segment\+\_\+head\+\_\+t\+::first\+\_\+chunk, mca\+\_\+allocator\+\_\+bucket\+\_\+bucket\+\_\+t\+::free\+\_\+chunk, mca\+\_\+allocator\+\_\+bucket\+\_\+t\+::get\+\_\+mem\+\_\+fn, mca\+\_\+allocator\+\_\+bucket\+\_\+bucket\+\_\+t\+::lock, mca\+\_\+allocator\+\_\+bucket\+\_\+chunk\+\_\+header\+\_\+t\+::u\+::next\+\_\+free, mca\+\_\+allocator\+\_\+bucket\+\_\+chunk\+\_\+header\+\_\+t\+::next\+\_\+in\+\_\+segment, mca\+\_\+allocator\+\_\+bucket\+\_\+segment\+\_\+head\+\_\+t\+::next\+\_\+segment, O\+P\+A\+L\+\_\+\+T\+H\+R\+E\+A\+D\+\_\+\+L\+O\+C\+K, O\+P\+A\+L\+\_\+\+T\+H\+R\+E\+A\+D\+\_\+\+U\+N\+L\+O\+C\+K, mca\+\_\+allocator\+\_\+bucket\+\_\+bucket\+\_\+t\+::segment\+\_\+head, mca\+\_\+allocator\+\_\+bucket\+\_\+t\+::super, and mca\+\_\+allocator\+\_\+bucket\+\_\+chunk\+\_\+header\+\_\+t\+::u.

\hypertarget{allocator__bucket__alloc_8h_af7a4706798db515d759099dc47ebd41c}{\index{allocator\+\_\+bucket\+\_\+alloc.\+h@{allocator\+\_\+bucket\+\_\+alloc.\+h}!mca\+\_\+allocator\+\_\+bucket\+\_\+cleanup@{mca\+\_\+allocator\+\_\+bucket\+\_\+cleanup}}
\index{mca\+\_\+allocator\+\_\+bucket\+\_\+cleanup@{mca\+\_\+allocator\+\_\+bucket\+\_\+cleanup}!allocator\+\_\+bucket\+\_\+alloc.\+h@{allocator\+\_\+bucket\+\_\+alloc.\+h}}
\subsubsection[{mca\+\_\+allocator\+\_\+bucket\+\_\+cleanup}]{\setlength{\rightskip}{0pt plus 5cm}int mca\+\_\+allocator\+\_\+bucket\+\_\+cleanup (
\begin{DoxyParamCaption}
\item[{{\bf mca\+\_\+allocator\+\_\+base\+\_\+module\+\_\+t} $\ast$}]{mem}
\end{DoxyParamCaption}
)}}\label{allocator__bucket__alloc_8h_af7a4706798db515d759099dc47ebd41c}


Frees all the memory from all the buckets back to the system. 

Note that this function only frees memory that was previously freed with \hyperlink{allocator__bucket__alloc_8h_aaed5641d1b04e39455a9a65296da8225}{mca\+\_\+allocator\+\_\+bucket\+\_\+free()}.


\begin{DoxyParams}{Parameters}
{\em mem} & A pointer to the appropriate struct for the area of memory.\\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Return values}
{\em None} & \\
\hline
\end{DoxyRetVals}


References mca\+\_\+allocator\+\_\+bucket\+\_\+chunk\+\_\+header\+\_\+t\+::u\+::bucket, mca\+\_\+allocator\+\_\+bucket\+\_\+t\+::buckets, mca\+\_\+allocator\+\_\+bucket\+\_\+segment\+\_\+head\+\_\+t\+::first\+\_\+chunk, mca\+\_\+allocator\+\_\+bucket\+\_\+bucket\+\_\+t\+::free\+\_\+chunk, mca\+\_\+allocator\+\_\+bucket\+\_\+t\+::free\+\_\+mem\+\_\+fn, mca\+\_\+allocator\+\_\+bucket\+\_\+bucket\+\_\+t\+::lock, mca\+\_\+allocator\+\_\+bucket\+\_\+chunk\+\_\+header\+\_\+t\+::u\+::next\+\_\+free, mca\+\_\+allocator\+\_\+bucket\+\_\+chunk\+\_\+header\+\_\+t\+::next\+\_\+in\+\_\+segment, mca\+\_\+allocator\+\_\+bucket\+\_\+segment\+\_\+head\+\_\+t\+::next\+\_\+segment, mca\+\_\+allocator\+\_\+bucket\+\_\+t\+::num\+\_\+buckets, O\+P\+A\+L\+\_\+\+T\+H\+R\+E\+A\+D\+\_\+\+L\+O\+C\+K, O\+P\+A\+L\+\_\+\+T\+H\+R\+E\+A\+D\+\_\+\+U\+N\+L\+O\+C\+K, mca\+\_\+allocator\+\_\+bucket\+\_\+bucket\+\_\+t\+::segment\+\_\+head, and mca\+\_\+allocator\+\_\+bucket\+\_\+chunk\+\_\+header\+\_\+t\+::u.



Referenced by mca\+\_\+allocator\+\_\+bucket\+\_\+finalize().

\hypertarget{allocator__bucket__alloc_8h_ab722dfbeed8509a826b3ce5435f28e38}{\index{allocator\+\_\+bucket\+\_\+alloc.\+h@{allocator\+\_\+bucket\+\_\+alloc.\+h}!mca\+\_\+allocator\+\_\+bucket\+\_\+finalize@{mca\+\_\+allocator\+\_\+bucket\+\_\+finalize}}
\index{mca\+\_\+allocator\+\_\+bucket\+\_\+finalize@{mca\+\_\+allocator\+\_\+bucket\+\_\+finalize}!allocator\+\_\+bucket\+\_\+alloc.\+h@{allocator\+\_\+bucket\+\_\+alloc.\+h}}
\subsubsection[{mca\+\_\+allocator\+\_\+bucket\+\_\+finalize}]{\setlength{\rightskip}{0pt plus 5cm}int mca\+\_\+allocator\+\_\+bucket\+\_\+finalize (
\begin{DoxyParamCaption}
\item[{{\bf mca\+\_\+allocator\+\_\+base\+\_\+module\+\_\+t} $\ast$}]{mem}
\end{DoxyParamCaption}
)}}\label{allocator__bucket__alloc_8h_ab722dfbeed8509a826b3ce5435f28e38}


Cleanup all resources held by this allocator. 


\begin{DoxyParams}{Parameters}
{\em mem} & A pointer to the appropriate struct for the area of memory.\\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Return values}
{\em None} & \\
\hline
\end{DoxyRetVals}


References mca\+\_\+allocator\+\_\+bucket\+\_\+cleanup().

\hypertarget{allocator__bucket__alloc_8h_aaed5641d1b04e39455a9a65296da8225}{\index{allocator\+\_\+bucket\+\_\+alloc.\+h@{allocator\+\_\+bucket\+\_\+alloc.\+h}!mca\+\_\+allocator\+\_\+bucket\+\_\+free@{mca\+\_\+allocator\+\_\+bucket\+\_\+free}}
\index{mca\+\_\+allocator\+\_\+bucket\+\_\+free@{mca\+\_\+allocator\+\_\+bucket\+\_\+free}!allocator\+\_\+bucket\+\_\+alloc.\+h@{allocator\+\_\+bucket\+\_\+alloc.\+h}}
\subsubsection[{mca\+\_\+allocator\+\_\+bucket\+\_\+free}]{\setlength{\rightskip}{0pt plus 5cm}void mca\+\_\+allocator\+\_\+bucket\+\_\+free (
\begin{DoxyParamCaption}
\item[{{\bf mca\+\_\+allocator\+\_\+base\+\_\+module\+\_\+t} $\ast$}]{mem, }
\item[{void $\ast$}]{ptr}
\end{DoxyParamCaption}
)}}\label{allocator__bucket__alloc_8h_aaed5641d1b04e39455a9a65296da8225}


Frees the passed region of memory. 


\begin{DoxyParams}{Parameters}
{\em mem} & A pointer to the appropriate struct for the area of memory. \\
\hline
{\em ptr} & A pointer to the region of memory to be freed\\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Return values}
{\em None} & \\
\hline
\end{DoxyRetVals}


References mca\+\_\+allocator\+\_\+bucket\+\_\+chunk\+\_\+header\+\_\+t\+::u\+::bucket, mca\+\_\+allocator\+\_\+bucket\+\_\+t\+::buckets, mca\+\_\+allocator\+\_\+bucket\+\_\+bucket\+\_\+t\+::free\+\_\+chunk, mca\+\_\+allocator\+\_\+bucket\+\_\+bucket\+\_\+t\+::lock, mca\+\_\+allocator\+\_\+bucket\+\_\+chunk\+\_\+header\+\_\+t\+::u\+::next\+\_\+free, O\+P\+A\+L\+\_\+\+T\+H\+R\+E\+A\+D\+\_\+\+L\+O\+C\+K, O\+P\+A\+L\+\_\+\+T\+H\+R\+E\+A\+D\+\_\+\+U\+N\+L\+O\+C\+K, and mca\+\_\+allocator\+\_\+bucket\+\_\+chunk\+\_\+header\+\_\+t\+::u.



Referenced by mca\+\_\+allocator\+\_\+bucket\+\_\+realloc().

\hypertarget{allocator__bucket__alloc_8h_aaec791259b8da050da0358f377552b36}{\index{allocator\+\_\+bucket\+\_\+alloc.\+h@{allocator\+\_\+bucket\+\_\+alloc.\+h}!mca\+\_\+allocator\+\_\+bucket\+\_\+init@{mca\+\_\+allocator\+\_\+bucket\+\_\+init}}
\index{mca\+\_\+allocator\+\_\+bucket\+\_\+init@{mca\+\_\+allocator\+\_\+bucket\+\_\+init}!allocator\+\_\+bucket\+\_\+alloc.\+h@{allocator\+\_\+bucket\+\_\+alloc.\+h}}
\subsubsection[{mca\+\_\+allocator\+\_\+bucket\+\_\+init}]{\setlength{\rightskip}{0pt plus 5cm}{\bf mca\+\_\+allocator\+\_\+bucket\+\_\+t}$\ast$ mca\+\_\+allocator\+\_\+bucket\+\_\+init (
\begin{DoxyParamCaption}
\item[{{\bf mca\+\_\+allocator\+\_\+base\+\_\+module\+\_\+t} $\ast$}]{mem, }
\item[{int}]{num\+\_\+buckets, }
\item[{{\bf mca\+\_\+allocator\+\_\+base\+\_\+component\+\_\+segment\+\_\+alloc\+\_\+fn\+\_\+t}}]{get\+\_\+mem\+\_\+funct, }
\item[{{\bf mca\+\_\+allocator\+\_\+base\+\_\+component\+\_\+segment\+\_\+free\+\_\+fn\+\_\+t}}]{free\+\_\+mem\+\_\+funct}
\end{DoxyParamCaption}
)}}\label{allocator__bucket__alloc_8h_aaec791259b8da050da0358f377552b36}


Initializes the mca\+\_\+allocator\+\_\+bucket\+\_\+options\+\_\+t data structure for the passed parameters. 


\begin{DoxyParams}{Parameters}
{\em mem} & a pointer to the mca\+\_\+allocator\+\_\+t struct to be filled in \\
\hline
{\em num\+\_\+buckets} & The number of buckets the allocator will use \\
\hline
{\em get\+\_\+mem\+\_\+funct} & A pointer to the function that the allocator will use to get more memory \\
\hline
{\em free\+\_\+mem\+\_\+funct} & A pointer to the function that the allocator will use to free memory\\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Return values}
{\em Pointer} & to the initialized mca\+\_\+allocator\+\_\+bucket\+\_\+options\+\_\+t structure \\
\hline
{\em N\+U\+L\+L} & if there was an error \\
\hline
\end{DoxyRetVals}


References mca\+\_\+allocator\+\_\+bucket\+\_\+t\+::buckets, mca\+\_\+allocator\+\_\+bucket\+\_\+bucket\+\_\+t\+::free\+\_\+chunk, mca\+\_\+allocator\+\_\+bucket\+\_\+t\+::free\+\_\+mem\+\_\+fn, mca\+\_\+allocator\+\_\+bucket\+\_\+t\+::get\+\_\+mem\+\_\+fn, mca\+\_\+allocator\+\_\+bucket\+\_\+bucket\+\_\+t\+::lock, mca\+\_\+allocator\+\_\+bucket\+\_\+t\+::num\+\_\+buckets, O\+B\+J\+\_\+\+C\+O\+N\+S\+T\+R\+U\+C\+T, and mca\+\_\+allocator\+\_\+bucket\+\_\+bucket\+\_\+t\+::segment\+\_\+head.

\hypertarget{allocator__bucket__alloc_8h_a788dca8f9a8a51ea97f455b041829f5c}{\index{allocator\+\_\+bucket\+\_\+alloc.\+h@{allocator\+\_\+bucket\+\_\+alloc.\+h}!mca\+\_\+allocator\+\_\+bucket\+\_\+realloc@{mca\+\_\+allocator\+\_\+bucket\+\_\+realloc}}
\index{mca\+\_\+allocator\+\_\+bucket\+\_\+realloc@{mca\+\_\+allocator\+\_\+bucket\+\_\+realloc}!allocator\+\_\+bucket\+\_\+alloc.\+h@{allocator\+\_\+bucket\+\_\+alloc.\+h}}
\subsubsection[{mca\+\_\+allocator\+\_\+bucket\+\_\+realloc}]{\setlength{\rightskip}{0pt plus 5cm}void$\ast$ mca\+\_\+allocator\+\_\+bucket\+\_\+realloc (
\begin{DoxyParamCaption}
\item[{{\bf mca\+\_\+allocator\+\_\+base\+\_\+module\+\_\+t} $\ast$}]{mem, }
\item[{void $\ast$}]{ptr, }
\item[{size\+\_\+t}]{size, }
\item[{{\bf mca\+\_\+mpool\+\_\+base\+\_\+registration\+\_\+t} $\ast$$\ast$}]{registration}
\end{DoxyParamCaption}
)}}\label{allocator__bucket__alloc_8h_a788dca8f9a8a51ea97f455b041829f5c}


Attempts to resize the passed region of memory into a larger or a smaller region. 

If it is unsuccessful, it will return N\+U\+L\+L and the passed area of memory will be untouched.


\begin{DoxyParams}{Parameters}
{\em mem} & A pointer to the appropriate struct for the area of memory. \\
\hline
{\em size} & The size of the requested area of memory \\
\hline
{\em ptr} & A pointer to the region of memory to be resized\\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Return values}
{\em Pointer} & to the area of memory if the reallocation was successful \\
\hline
{\em N\+U\+L\+L} & if the allocation was unsuccessful \\
\hline
\end{DoxyRetVals}


References mca\+\_\+allocator\+\_\+bucket\+\_\+chunk\+\_\+header\+\_\+t\+::u\+::bucket, mca\+\_\+allocator\+\_\+bucket\+\_\+alloc(), mca\+\_\+allocator\+\_\+bucket\+\_\+free(), and mca\+\_\+allocator\+\_\+bucket\+\_\+chunk\+\_\+header\+\_\+t\+::u.

