\hypertarget{group__allocationmemory}{}\doxysection{SVM memory allocation}
\label{group__allocationmemory}\index{SVM memory allocation@{SVM memory allocation}}


This module contains API functions to handle SVM memory allocation.  


\doxysubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
\mbox{\hyperlink{group__apimacros_ga0d0dae93534c2ba22499a92705a4e391}{SVM\+\_\+\+FUNCTION}} \mbox{\hyperlink{group__api__types_ga613f7430f76ab41fd47f6a386c370828}{SVM\+\_\+\+Value\+\_\+\+Pointer}} \mbox{\hyperlink{group__allocationmemory_gabc086ae85392ff9c51a146a7040c5a67}{svm\+\_\+memory\+\_\+allocate}} (const void $\ast$svm, const \mbox{\hyperlink{group__api__types_ga19af2c6060f3ae282ea4e73121fac69c}{SVM\+\_\+\+Kernel}} kernel, const \mbox{\hyperlink{group__api__types_gab09bc91d1ed2c59cf667d75b06fb3170}{SVM\+\_\+\+Memory\+\_\+\+Zone}} zone)
\begin{DoxyCompactList}\small\item\em This function allocates a zone in a memory. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__apimacros_ga0d0dae93534c2ba22499a92705a4e391}{SVM\+\_\+\+FUNCTION}} \mbox{\hyperlink{group__api__types_ga613f7430f76ab41fd47f6a386c370828}{SVM\+\_\+\+Value\+\_\+\+Pointer}} \mbox{\hyperlink{group__allocationmemory_ga264a0edebab5acb04ec59632f679a239}{svm\+\_\+memory\+\_\+allocate\+\_\+address}} (const void $\ast$svm, const \mbox{\hyperlink{group__api__types_ga19af2c6060f3ae282ea4e73121fac69c}{SVM\+\_\+\+Kernel}} kernel, const \mbox{\hyperlink{group__api__types_gab09bc91d1ed2c59cf667d75b06fb3170}{SVM\+\_\+\+Memory\+\_\+\+Zone}} zone, const \mbox{\hyperlink{group__api__types_gae19c9a8c6077446e11c34dd11059f647}{SVM\+\_\+\+Address}} address)
\begin{DoxyCompactList}\small\item\em This function allocates a zone in a memory at a specified address. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__apimacros_ga0d0dae93534c2ba22499a92705a4e391}{SVM\+\_\+\+FUNCTION}} void \mbox{\hyperlink{group__allocationmemory_ga9742dde70ad58f68d943b50cd54c7d6f}{svm\+\_\+memory\+\_\+free}} (const void $\ast$svm, const \mbox{\hyperlink{group__api__types_ga19af2c6060f3ae282ea4e73121fac69c}{SVM\+\_\+\+Kernel}} kernel, const \mbox{\hyperlink{group__api__types_ga613f7430f76ab41fd47f6a386c370828}{SVM\+\_\+\+Value\+\_\+\+Pointer}} pointer)
\begin{DoxyCompactList}\small\item\em This function frees a memory zone. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
This module contains API functions to handle SVM memory allocation. 



\doxysubsection{Function Documentation}
\mbox{\Hypertarget{group__allocationmemory_gabc086ae85392ff9c51a146a7040c5a67}\label{group__allocationmemory_gabc086ae85392ff9c51a146a7040c5a67}} 
\index{SVM memory allocation@{SVM memory allocation}!svm\_memory\_allocate@{svm\_memory\_allocate}}
\index{svm\_memory\_allocate@{svm\_memory\_allocate}!SVM memory allocation@{SVM memory allocation}}
\doxysubsubsection{\texorpdfstring{svm\_memory\_allocate()}{svm\_memory\_allocate()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__apimacros_ga0d0dae93534c2ba22499a92705a4e391}{SVM\+\_\+\+FUNCTION}} \mbox{\hyperlink{group__api__types_ga613f7430f76ab41fd47f6a386c370828}{SVM\+\_\+\+Value\+\_\+\+Pointer}} svm\+\_\+memory\+\_\+allocate (\begin{DoxyParamCaption}\item[{const void $\ast$}]{svm,  }\item[{const \mbox{\hyperlink{group__api__types_ga19af2c6060f3ae282ea4e73121fac69c}{SVM\+\_\+\+Kernel}}}]{kernel,  }\item[{const \mbox{\hyperlink{group__api__types_gab09bc91d1ed2c59cf667d75b06fb3170}{SVM\+\_\+\+Memory\+\_\+\+Zone}}}]{zone }\end{DoxyParamCaption})}



This function allocates a zone in a memory. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em svm} & The SVM pointer passed as first argument of the callback function. \\
\hline
\mbox{\texttt{ in}}  & {\em kernel} & The kernel in which the targeted memory is. \\
\hline
\mbox{\texttt{ in}}  & {\em zone} & The zone description to allocate.\\
\hline
\end{DoxyParams}
\begin{DoxyWarning}{Warning}
The allocated memory is local and will be freed at the end of the current SVM function. Please refer to the svm\+\_\+memory\+\_\+scope\+\_\+set\+\_\+global and svm\+\_\+memory\+\_\+pointer\+\_\+list\+\_\+accessible API functions to create global memory.
\end{DoxyWarning}
\begin{DoxyNote}{Note}
The allocated memory is not initialised. It means each allocated addresses contains a type but no value.
\end{DoxyNote}
\begin{DoxyReturn}{Returns}
The pointer containing the zone location.
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em FAILURE} & interruption when a parameter is incorrect. (Please refer to the main description page of this API.) \\
\hline
{\em FAILURE} & interruption when the kernel is not owned by our process or is not in a process locked by ours.\\
\hline
\end{DoxyExceptions}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{group__memoriesscope_gaff1e6359629f45e8889368b87a2ee0ed}{svm\+\_\+memory\+\_\+scope\+\_\+set\+\_\+global}} 

\mbox{\hyperlink{group__pointermemory_ga57f6fada714525fd3ce71fb1d0341765}{svm\+\_\+memory\+\_\+pointer\+\_\+list\+\_\+accessible}} 

\mbox{\hyperlink{group__ownershipprocesses_ga535796c3203a2baa8095c951b9b2c205}{svm\+\_\+process\+\_\+ownership\+\_\+lock}} 

\mbox{\hyperlink{group__getkernels_gad6a03dbf0dd283278cdc4bbc2266efa5}{svm\+\_\+kernel\+\_\+get\+\_\+current}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{group__allocationmemory_ga264a0edebab5acb04ec59632f679a239}\label{group__allocationmemory_ga264a0edebab5acb04ec59632f679a239}} 
\index{SVM memory allocation@{SVM memory allocation}!svm\_memory\_allocate\_address@{svm\_memory\_allocate\_address}}
\index{svm\_memory\_allocate\_address@{svm\_memory\_allocate\_address}!SVM memory allocation@{SVM memory allocation}}
\doxysubsubsection{\texorpdfstring{svm\_memory\_allocate\_address()}{svm\_memory\_allocate\_address()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__apimacros_ga0d0dae93534c2ba22499a92705a4e391}{SVM\+\_\+\+FUNCTION}} \mbox{\hyperlink{group__api__types_ga613f7430f76ab41fd47f6a386c370828}{SVM\+\_\+\+Value\+\_\+\+Pointer}} svm\+\_\+memory\+\_\+allocate\+\_\+address (\begin{DoxyParamCaption}\item[{const void $\ast$}]{svm,  }\item[{const \mbox{\hyperlink{group__api__types_ga19af2c6060f3ae282ea4e73121fac69c}{SVM\+\_\+\+Kernel}}}]{kernel,  }\item[{const \mbox{\hyperlink{group__api__types_gab09bc91d1ed2c59cf667d75b06fb3170}{SVM\+\_\+\+Memory\+\_\+\+Zone}}}]{zone,  }\item[{const \mbox{\hyperlink{group__api__types_gae19c9a8c6077446e11c34dd11059f647}{SVM\+\_\+\+Address}}}]{address }\end{DoxyParamCaption})}



This function allocates a zone in a memory at a specified address. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em svm} & The SVM pointer passed as first argument of the callback function. \\
\hline
\mbox{\texttt{ in}}  & {\em kernel} & The kernel in which the targeted memory is. \\
\hline
\mbox{\texttt{ in}}  & {\em zone} & The zone description to allocate. \\
\hline
\mbox{\texttt{ in}}  & {\em address} & The address where to allocate the memory.\\
\hline
\end{DoxyParams}
\begin{DoxyWarning}{Warning}
The allocated memory is local and will be freed at the end of the current SVM function. Please refer to the svm\+\_\+memory\+\_\+scope\+\_\+set\+\_\+global and svm\+\_\+memory\+\_\+pointer\+\_\+list\+\_\+accessible API functions to create global memory.
\end{DoxyWarning}
\begin{DoxyNote}{Note}
The allocated memory is not initialised. It means each allocated addresses contains a type but no value.
\end{DoxyNote}
\begin{DoxyReturn}{Returns}
The pointer containing the zone location when the allocation succeeds. A null pointer is returned otherwise.
\end{DoxyReturn}
Example\+: 
\begin{DoxyCode}{0}
\DoxyCodeLine{\mbox{\hyperlink{group__api__types_ga613f7430f76ab41fd47f6a386c370828}{SVM\_Value\_Pointer}} p = \mbox{\hyperlink{group__allocationmemory_ga264a0edebab5acb04ec59632f679a239}{svm\_memory\_allocate\_address}}(svm,\mbox{\hyperlink{group__getkernels_gad6a03dbf0dd283278cdc4bbc2266efa5}{svm\_kernel\_get\_current}}(svm),zone,address);}
\DoxyCodeLine{\textcolor{keywordflow}{if}(\mbox{\hyperlink{group__valuesstate_gaaaf0e2713e113735546686e07c364ab3}{svm\_value\_state\_is\_null}}(svm,p))}
\DoxyCodeLine{\{}
\DoxyCodeLine{    \mbox{\hyperlink{group__errorprocessors_gaee1564837bfe9a62ef8fa5808fa72e90}{svm\_processor\_current\_raise\_error\_internal\_\_raw}}(svm,\mbox{\hyperlink{group__api__types_ggab74f35a11b36bda28236d1baa7d87d8caa0f690187a3a023c04b409b4f653a4a1}{MEMORY}},\textcolor{stringliteral}{"{}Unable to reserve memory"{}});}
\DoxyCodeLine{\}}

\end{DoxyCode}



\begin{DoxyExceptions}{Exceptions}
{\em FAILURE} & interruption when a parameter is incorrect. (Please refer to the main description page of this API.) \\
\hline
{\em FAILURE} & interruption when the kernel is not owned by our process or is not in a process locked by ours.\\
\hline
\end{DoxyExceptions}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{group__memoriesscope_gaff1e6359629f45e8889368b87a2ee0ed}{svm\+\_\+memory\+\_\+scope\+\_\+set\+\_\+global}} 

\mbox{\hyperlink{group__pointermemory_ga57f6fada714525fd3ce71fb1d0341765}{svm\+\_\+memory\+\_\+pointer\+\_\+list\+\_\+accessible}} 

\mbox{\hyperlink{group__ownershipprocesses_ga535796c3203a2baa8095c951b9b2c205}{svm\+\_\+process\+\_\+ownership\+\_\+lock}} 

\mbox{\hyperlink{group__getkernels_gad6a03dbf0dd283278cdc4bbc2266efa5}{svm\+\_\+kernel\+\_\+get\+\_\+current}} 

\mbox{\hyperlink{group__valuesstate_gaaaf0e2713e113735546686e07c364ab3}{svm\+\_\+value\+\_\+state\+\_\+is\+\_\+null}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{group__allocationmemory_ga9742dde70ad58f68d943b50cd54c7d6f}\label{group__allocationmemory_ga9742dde70ad58f68d943b50cd54c7d6f}} 
\index{SVM memory allocation@{SVM memory allocation}!svm\_memory\_free@{svm\_memory\_free}}
\index{svm\_memory\_free@{svm\_memory\_free}!SVM memory allocation@{SVM memory allocation}}
\doxysubsubsection{\texorpdfstring{svm\_memory\_free()}{svm\_memory\_free()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__apimacros_ga0d0dae93534c2ba22499a92705a4e391}{SVM\+\_\+\+FUNCTION}} void svm\+\_\+memory\+\_\+free (\begin{DoxyParamCaption}\item[{const void $\ast$}]{svm,  }\item[{const \mbox{\hyperlink{group__api__types_ga19af2c6060f3ae282ea4e73121fac69c}{SVM\+\_\+\+Kernel}}}]{kernel,  }\item[{const \mbox{\hyperlink{group__api__types_ga613f7430f76ab41fd47f6a386c370828}{SVM\+\_\+\+Value\+\_\+\+Pointer}}}]{pointer }\end{DoxyParamCaption})}



This function frees a memory zone. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em svm} & The SVM pointer passed as first argument of the callback function. \\
\hline
\mbox{\texttt{ in}}  & {\em kernel} & The kernel in which the targeted memory is. \\
\hline
\mbox{\texttt{ in}}  & {\em pointer} & The pointer locating the memory zone.\\
\hline
\end{DoxyParams}
The targeted addresses are removed from the memory.

\begin{DoxyNote}{Note}
The scope of the memory is unchanged.
\end{DoxyNote}

\begin{DoxyExceptions}{Exceptions}
{\em FAILURE} & interruption when a parameter is incorrect. (Please refer to the main description page of this API.)\\
\hline
\end{DoxyExceptions}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{group__memoriesscope_ga3b42f589fe7b6fe25eb081af853fde57}{svm\+\_\+memory\+\_\+scope\+\_\+set\+\_\+local}} 
\end{DoxySeeAlso}
