\hypertarget{allocator__basic_8h}{\section{ompi/mca/allocator/basic/allocator\+\_\+basic.h File Reference}
\label{allocator__basic_8h}\index{ompi/mca/allocator/basic/allocator\+\_\+basic.\+h@{ompi/mca/allocator/basic/allocator\+\_\+basic.\+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/class/ompi\+\_\+free\+\_\+list.\+h\char`\"{}}\\*
{\ttfamily \#include \char`\"{}ompi/mca/allocator/allocator.\+h\char`\"{}}\\*
\subsection*{Data Structures}
\begin{DoxyCompactItemize}
\item 
struct \hyperlink{structmca__allocator__basic__segment__t}{mca\+\_\+allocator\+\_\+basic\+\_\+segment\+\_\+t}
\item 
struct \hyperlink{structmca__allocator__basic__module__t}{mca\+\_\+allocator\+\_\+basic\+\_\+module\+\_\+t}
\end{DoxyCompactItemize}
\subsection*{Typedefs}
\begin{DoxyCompactItemize}
\item 
\hypertarget{allocator__basic_8h_a0c1a3b930c0e645694aa13941dc34eb2}{typedef struct \\*
\hyperlink{structmca__allocator__basic__segment__t}{mca\+\_\+allocator\+\_\+basic\+\_\+segment\+\_\+t} {\bfseries mca\+\_\+allocator\+\_\+basic\+\_\+segment\+\_\+t}}\label{allocator__basic_8h_a0c1a3b930c0e645694aa13941dc34eb2}

\item 
\hypertarget{allocator__basic_8h_ad63f31765db5f1009eccd1025cb1a215}{typedef struct \\*
\hyperlink{structmca__allocator__basic__module__t}{mca\+\_\+allocator\+\_\+basic\+\_\+module\+\_\+t} {\bfseries mca\+\_\+allocator\+\_\+basic\+\_\+module\+\_\+t}}\label{allocator__basic_8h_ad63f31765db5f1009eccd1025cb1a215}

\end{DoxyCompactItemize}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
\hypertarget{allocator__basic_8h_aaf396fcb3582fed1273a56a52d4990ac}{B\+E\+G\+I\+N\+\_\+\+C\+\_\+\+D\+E\+C\+L\+S int {\bfseries mca\+\_\+allocator\+\_\+basic\+\_\+component\+\_\+open} (void)}\label{allocator__basic_8h_aaf396fcb3582fed1273a56a52d4990ac}

\item 
\hypertarget{allocator__basic_8h_a5404995c7fac7348bd32c9b602b38c42}{int {\bfseries mca\+\_\+allocator\+\_\+basic\+\_\+component\+\_\+close} (void)}\label{allocator__basic_8h_a5404995c7fac7348bd32c9b602b38c42}

\item 
\hypertarget{allocator__basic_8h_a141d5a6def8597bbbe76b36f46d66d79}{\hyperlink{structmca__allocator__base__module__t}{mca\+\_\+allocator\+\_\+base\+\_\+module\+\_\+t} $\ast$ \hyperlink{allocator__basic_8h_a141d5a6def8597bbbe76b36f46d66d79}{mca\+\_\+allocator\+\_\+basic\+\_\+component\+\_\+init} (bool enable\+\_\+mpi\+\_\+threads, \hyperlink{allocator_8h_a5472d80a69d79779b45fe4d01276ff6c}{mca\+\_\+allocator\+\_\+base\+\_\+component\+\_\+segment\+\_\+alloc\+\_\+fn\+\_\+t} segment\+\_\+alloc, \hyperlink{allocator_8h_a33e0a8ba4ad4dd42764679363fa38faf}{mca\+\_\+allocator\+\_\+base\+\_\+component\+\_\+segment\+\_\+free\+\_\+fn\+\_\+t} segment\+\_\+free, struct \hyperlink{structmca__mpool__base__module__t}{mca\+\_\+mpool\+\_\+base\+\_\+module\+\_\+t} $\ast$module)}\label{allocator__basic_8h_a141d5a6def8597bbbe76b36f46d66d79}

\begin{DoxyCompactList}\small\item\em The function used to initialize the component. \end{DoxyCompactList}\item 
void $\ast$ \hyperlink{allocator__basic_8h_ae027001c74d3438053a090ccc9a09453}{mca\+\_\+allocator\+\_\+basic\+\_\+alloc} (\hyperlink{structmca__allocator__base__module__t}{mca\+\_\+allocator\+\_\+base\+\_\+module\+\_\+t} $\ast$mem, size\+\_\+t size, size\+\_\+t align, \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\+\_\+basic\+\_\+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__basic_8h_ac94bf5a08ed1064eaf13e1d9e9b19648}{mca\+\_\+allocator\+\_\+basic\+\_\+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__basic_8h_a835df3775f416ef259d882698725ad15}{mca\+\_\+allocator\+\_\+basic\+\_\+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__basic_8h_a3062b09623829d6e113c8a2c18eff571}{mca\+\_\+allocator\+\_\+basic\+\_\+compact} (\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 basics back to the system. \end{DoxyCompactList}\item 
int \hyperlink{allocator__basic_8h_a75ad6f9c814a983a947439e63393d18e}{mca\+\_\+allocator\+\_\+basic\+\_\+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__basic_8h_ae3d8e84dec8cc80942a11fecb0cb0e61}{O\+M\+P\+I\+\_\+\+D\+E\+C\+L\+S\+P\+E\+C \\*
\hyperlink{allocator_8h_adba0f37f8491efef97cc54cc69966bb8}{mca\+\_\+allocator\+\_\+base\+\_\+component\+\_\+t} {\bfseries mca\+\_\+allocator\+\_\+basic\+\_\+component}}\label{allocator__basic_8h_ae3d8e84dec8cc80942a11fecb0cb0e61}

\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 basic allocator. 

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


Accepts a request for memory in a specific region defined by the mca\+\_\+allocator\+\_\+basic\+\_\+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 opal\+\_\+list\+\_\+append, opal\+\_\+list\+\_\+get\+\_\+end(), opal\+\_\+list\+\_\+get\+\_\+first(), opal\+\_\+list\+\_\+get\+\_\+next, opal\+\_\+list\+\_\+remove\+\_\+item(), O\+P\+A\+L\+\_\+\+T\+H\+R\+E\+A\+D\+\_\+\+L\+O\+C\+K, and O\+P\+A\+L\+\_\+\+T\+H\+R\+E\+A\+D\+\_\+\+U\+N\+L\+O\+C\+K.



Referenced by mca\+\_\+allocator\+\_\+basic\+\_\+component\+\_\+init(), and mca\+\_\+allocator\+\_\+basic\+\_\+realloc().

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


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

Note that this function only frees memory that was previously freed with \hyperlink{allocator__basic_8h_a835df3775f416ef259d882698725ad15}{mca\+\_\+allocator\+\_\+basic\+\_\+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}


Referenced by mca\+\_\+allocator\+\_\+basic\+\_\+component\+\_\+init().

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


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 O\+B\+J\+\_\+\+D\+E\+S\+T\+R\+U\+C\+T.



Referenced by mca\+\_\+allocator\+\_\+basic\+\_\+component\+\_\+init().

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


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 opal\+\_\+list\+\_\+append, opal\+\_\+list\+\_\+get\+\_\+end(), opal\+\_\+list\+\_\+get\+\_\+first(), opal\+\_\+list\+\_\+get\+\_\+next, opal\+\_\+list\+\_\+insert\+\_\+pos(), O\+P\+A\+L\+\_\+\+T\+H\+R\+E\+A\+D\+\_\+\+L\+O\+C\+K, and O\+P\+A\+L\+\_\+\+T\+H\+R\+E\+A\+D\+\_\+\+U\+N\+L\+O\+C\+K.



Referenced by mca\+\_\+allocator\+\_\+basic\+\_\+component\+\_\+init(), and mca\+\_\+allocator\+\_\+basic\+\_\+realloc().

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


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\+\_\+basic\+\_\+alloc(), and mca\+\_\+allocator\+\_\+basic\+\_\+free().



Referenced by mca\+\_\+allocator\+\_\+basic\+\_\+component\+\_\+init().

