<?xml version='1.0'?>
<html xmlns='http://www.w3.org/1999/xhtml'
      xmlns:math='http://www.w3.org/1998/Math/MathML'
>
<head>
<title>Return Memory to thread_alloc</title>
<meta name="description" id="description" content="Return Memory to thread_alloc"/>
<meta name="keywords" id="keywords" content=" return_memory thread_alloc memory available thread "/>
<style type='text/css'>
body { color : black }
body { background-color : white }
A:link { color : blue }
A:visited { color : purple }
A:active { color : purple }
</style>
<script type='text/javascript' language='JavaScript' src='_ta_return_memory_xml.js'>
</script>
</head>
<body>
<table><tr>
<td>
<a href="http://www.coin-or.org/CppAD/" target="_top"><img border="0" src="_image.gif"/></a>
</td>
<td><a href="ta_get_memory.xml" target="_top">Prev</a>
</td><td><a href="ta_free_available.xml" target="_top">Next</a>
</td><td>
<select onchange='choose_across0(this)'>
<option>Index-&gt;</option>
<option>contents</option>
<option>reference</option>
<option>index</option>
<option>search</option>
<option>external</option>
</select>
</td>
<td>
<select onchange='choose_up0(this)'>
<option>Up-&gt;</option>
<option>CppAD</option>
<option>library</option>
<option>thread_alloc</option>
<option>ta_return_memory</option>
</select>
</td>
<td>
<select onchange='choose_down3(this)'>
<option>CppAD-&gt;</option>
<option>Install</option>
<option>Introduction</option>
<option>AD</option>
<option>ADFun</option>
<option>multi_thread</option>
<option>library</option>
<option>cppad_ipopt_nlp</option>
<option>Example</option>
<option>preprocessor</option>
<option>Appendix</option>
</select>
</td>
<td>
<select onchange='choose_down2(this)'>
<option>library-&gt;</option>
<option>ErrorHandler</option>
<option>NearEqual</option>
<option>speed_test</option>
<option>SpeedTest</option>
<option>time_test</option>
<option>NumericType</option>
<option>CheckNumericType</option>
<option>SimpleVector</option>
<option>CheckSimpleVector</option>
<option>nan</option>
<option>pow_int</option>
<option>Poly</option>
<option>LuDetAndSolve</option>
<option>RombergOne</option>
<option>RombergMul</option>
<option>Runge45</option>
<option>Rosen34</option>
<option>OdeErrControl</option>
<option>OdeGear</option>
<option>OdeGearControl</option>
<option>BenderQuad</option>
<option>opt_val_hes</option>
<option>LuRatio</option>
<option>CppAD_vector</option>
<option>thread_alloc</option>
</select>
</td>
<td>
<select onchange='choose_down1(this)'>
<option>thread_alloc-&gt;</option>
<option>thread_alloc.cpp</option>
<option>ta_parallel_setup</option>
<option>ta_num_threads</option>
<option>ta_in_parallel</option>
<option>ta_thread_num</option>
<option>ta_get_memory</option>
<option>ta_return_memory</option>
<option>ta_free_available</option>
<option>ta_hold_memory</option>
<option>ta_inuse</option>
<option>ta_available</option>
<option>ta_create_array</option>
<option>ta_delete_array</option>
<option>ta_free_all</option>
</select>
</td>
<td>ta_return_memory</td>
<td>
<select onchange='choose_current0(this)'>
<option>Headings-&gt;</option>
<option>Syntax</option>
<option>Purpose</option>
<option>v_ptr</option>
<option>Thread</option>
<option>NDEBUG</option>
<option>Example</option>
</select>
</td>
</tr></table><br/>



<center><b><big><big>Return Memory to thread_alloc</big></big></b></center>
<br/>
<b><big><a name="Syntax" id="Syntax">Syntax</a></big></b>

<br/>

<code><font color="blue"><span style='white-space: nowrap'>thread_alloc::return_memory(</span></font><i><font color="black"><span style='white-space: nowrap'>v_ptr</span></font></i><font color="blue"><span style='white-space: nowrap'>)</span></font></code>


<br/>
<br/>
<b><big><a name="Purpose" id="Purpose">Purpose</a></big></b>
<br/>
If <a href="ta_hold_memory.xml" target="_top"><span style='white-space: nowrap'>hold_memory</span></a>
 is false,
the memory is returned to the system.
Otherwise, the memory is retained by <a href="thread_alloc.xml" target="_top"><span style='white-space: nowrap'>thread_alloc</span></a>
 for quick future use
by the thread that allocated to memory.

<br/>
<br/>
<b><big><a name="v_ptr" id="v_ptr">v_ptr</a></big></b>
<br/>
This argument has prototype

<code><font color="blue"><span style='white-space: nowrap'><br/>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;void*&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>v_ptr</span></font></i><font color="blue"><span style='white-space: nowrap'><br/>
</span></font></code>
.
It must be a pointer to memory that is currently in use; i.e.
obtained by a previous call to 
<a href="ta_get_memory.xml" target="_top"><span style='white-space: nowrap'>get_memory</span></a>
 and not yet returned.

<br/>
<br/>
<b><big><a name="Thread" id="Thread">Thread</a></big></b>
<br/>
Either the <a href="ta_thread_num.xml" target="_top"><span style='white-space: nowrap'>current&#xA0;thread</span></a>
 must be the same as during
the corresponding call to <a href="ta_get_memory.xml" target="_top"><span style='white-space: nowrap'>get_memory</span></a>
,
or the current execution mode must be sequential 
(not <a href="ta_in_parallel.xml" target="_top"><span style='white-space: nowrap'>parallel</span></a>
).

<br/>
<br/>
<b><big><a name="NDEBUG" id="NDEBUG">NDEBUG</a></big></b>
<br/>
If <code><font color="blue">NDEBUG</font></code> is defined, 
<code><i><font color="black"><span style='white-space: nowrap'>v_ptr</span></font></i></code>
 is not checked (this is faster).
Otherwise, a list of in use pointers is searched to make sure
that 
<code><i><font color="black"><span style='white-space: nowrap'>v_ptr</span></font></i></code>
 is in the list. 

<br/>
<br/>
<b><big><a name="Example" id="Example">Example</a></big></b>

<br/>
<a href="thread_alloc.cpp.xml" target="_top"><span style='white-space: nowrap'>thread_alloc.cpp</span></a>



<hr/>Input File: cppad/thread_alloc.hpp

</body>
</html>

