Sophie

Sophie

distrib > Fedora > 15 > i386 > by-pkgid > 583ffa4ba069126c3ba0bc565dc0485a > files > 1414

cvc3-doc-2.4.1-1.fc15.noarch.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>CVC3: memory_manager_context.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.7.4 -->
<div id="top">
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">CVC3&#160;<span id="projectnumber">2.4.1</span></div>
  </td>
 </tr>
 </tbody>
</table>
</div>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
<div class="header">
  <div class="headertitle">
<div class="title">memory_manager_context.h</div>  </div>
</div>
<div class="contents">
<a href="memory__manager__context_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*****************************************************************************/</span><span class="comment"></span>
<a name="l00002"></a>00002 <span class="comment">/*!</span>
<a name="l00003"></a>00003 <span class="comment"> *\file memory_manager_context.h</span>
<a name="l00004"></a>00004 <span class="comment"> *\brief Stack-based memory manager</span>
<a name="l00005"></a>00005 <span class="comment"> *</span>
<a name="l00006"></a>00006 <span class="comment"> * Author: Clark Barrett</span>
<a name="l00007"></a>00007 <span class="comment"> *</span>
<a name="l00008"></a>00008 <span class="comment"> * Created: Thu Aug  3 21:39:07 2006</span>
<a name="l00009"></a>00009 <span class="comment"> *</span>
<a name="l00010"></a>00010 <span class="comment"> * &lt;hr&gt;</span>
<a name="l00011"></a>00011 <span class="comment"> *</span>
<a name="l00012"></a>00012 <span class="comment"> * License to use, copy, modify, sell and/or distribute this software</span>
<a name="l00013"></a>00013 <span class="comment"> * and its documentation for any purpose is hereby granted without</span>
<a name="l00014"></a>00014 <span class="comment"> * royalty, subject to the terms and conditions defined in the \ref</span>
<a name="l00015"></a>00015 <span class="comment"> * LICENSE file provided with this distribution.</span>
<a name="l00016"></a>00016 <span class="comment"> *</span>
<a name="l00017"></a>00017 <span class="comment"> * &lt;hr&gt;</span>
<a name="l00018"></a>00018 <span class="comment"> */</span>
<a name="l00019"></a>00019 <span class="comment">/*****************************************************************************/</span>
<a name="l00020"></a>00020 
<a name="l00021"></a>00021 <span class="preprocessor">#ifndef _cvc3__include__memory_manager_context_h</span>
<a name="l00022"></a>00022 <span class="preprocessor"></span><span class="preprocessor">#define _cvc3__include__memory_manager_context_h</span>
<a name="l00023"></a>00023 <span class="preprocessor"></span>
<a name="l00024"></a>00024 <span class="preprocessor">#include &lt;cstdlib&gt;</span>
<a name="l00025"></a>00025 <span class="preprocessor">#include &lt;vector&gt;</span>
<a name="l00026"></a>00026 <span class="preprocessor">#include &quot;<a class="code" href="memory__manager_8h.html">memory_manager.h</a>&quot;</span>
<a name="l00027"></a>00027 
<a name="l00028"></a>00028 <span class="keyword">namespace </span>CVC3 {
<a name="l00029"></a>00029 
<a name="l00030"></a><a class="code" href="namespaceCVC3.html#a4989066010e7e60055e399649ba6368c">00030</a>   <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <a class="code" href="namespaceCVC3.html#a4989066010e7e60055e399649ba6368c">chunkSizeBytes</a> = 16384; <span class="comment">// #bytes in each chunk</span>
<a name="l00031"></a>00031 
<a name="l00032"></a>00032 <span class="comment">/*****************************************************************************/</span><span class="comment"></span>
<a name="l00033"></a>00033 <span class="comment">/*!</span>
<a name="l00034"></a>00034 <span class="comment"> *\class ContextMemoryManager</span>
<a name="l00035"></a>00035 <span class="comment"> *\brief ContextMemoryManager</span>
<a name="l00036"></a>00036 <span class="comment"> *</span>
<a name="l00037"></a>00037 <span class="comment"> * Author: Clark Barrett</span>
<a name="l00038"></a>00038 <span class="comment"> *</span>
<a name="l00039"></a>00039 <span class="comment"> * Created: Thu Aug  3 16:41:35 2006</span>
<a name="l00040"></a>00040 <span class="comment"> *</span>
<a name="l00041"></a>00041 <span class="comment"> * Stack-based memory manager</span>
<a name="l00042"></a>00042 <span class="comment"> */</span>
<a name="l00043"></a>00043 <span class="comment">/*****************************************************************************/</span>
<a name="l00044"></a><a class="code" href="classCVC3_1_1ContextMemoryManager.html">00044</a> <span class="keyword">class </span><a class="code" href="classCVC3_1_1ContextMemoryManager.html" title="ContextMemoryManager.">ContextMemoryManager</a> :<span class="keyword">public</span> <a class="code" href="classCVC3_1_1MemoryManager.html">MemoryManager</a> {
<a name="l00045"></a><a class="code" href="classCVC3_1_1ContextMemoryManager.html#a5f5f52c997313f654d93e1f3d2dad128">00045</a>   <span class="keyword">static</span> std::vector&lt;char*&gt; <a class="code" href="classCVC3_1_1ContextMemoryManager.html#a5f5f52c997313f654d93e1f3d2dad128">s_freePages</a>;
<a name="l00046"></a><a class="code" href="classCVC3_1_1ContextMemoryManager.html#a804b2ca6c7df4db2ffe7893d2d642390">00046</a>   std::vector&lt;char*&gt; <a class="code" href="classCVC3_1_1ContextMemoryManager.html#a804b2ca6c7df4db2ffe7893d2d642390">d_chunkList</a>; <span class="comment">// Pointers to the beginning of each chunk</span>
<a name="l00047"></a>00047 
<a name="l00048"></a>00048   <span class="comment">// Pointers to the next free block of memory in the current chunk</span>
<a name="l00049"></a><a class="code" href="classCVC3_1_1ContextMemoryManager.html#a169906c6e3ed4e95b0d596ee43b460c7">00049</a>   <span class="keywordtype">char</span>* <a class="code" href="classCVC3_1_1ContextMemoryManager.html#a169906c6e3ed4e95b0d596ee43b460c7">d_nextFree</a>;
<a name="l00050"></a>00050   <span class="comment">// Pointer to end of current chunk (1 byte off the end)</span>
<a name="l00051"></a><a class="code" href="classCVC3_1_1ContextMemoryManager.html#a4550ccf98fb2409d0ab706090aacc932">00051</a>   <span class="keywordtype">char</span>* <a class="code" href="classCVC3_1_1ContextMemoryManager.html#a4550ccf98fb2409d0ab706090aacc932">d_endChunk</a>;
<a name="l00052"></a>00052   <span class="comment">// Index into chunk vector</span>
<a name="l00053"></a><a class="code" href="classCVC3_1_1ContextMemoryManager.html#a98cd8114b2fb756f54eb7adf8609d7ff">00053</a>   <span class="keywordtype">unsigned</span> <a class="code" href="classCVC3_1_1ContextMemoryManager.html#a98cd8114b2fb756f54eb7adf8609d7ff">d_indexChunkList</a>;
<a name="l00054"></a>00054 
<a name="l00055"></a>00055   <span class="comment">// Stack of pointers to the next free block of memory in the current chunk</span>
<a name="l00056"></a><a class="code" href="classCVC3_1_1ContextMemoryManager.html#ac1a646d90c65cb8cccae99783282ce98">00056</a>   std::vector&lt;char*&gt; <a class="code" href="classCVC3_1_1ContextMemoryManager.html#ac1a646d90c65cb8cccae99783282ce98">d_nextFreeStack</a>;
<a name="l00057"></a>00057   <span class="comment">// Stack of pointers to end of current chunk (1 byte off the end)</span>
<a name="l00058"></a><a class="code" href="classCVC3_1_1ContextMemoryManager.html#a072fc7388a4d4ee1c9ab41e86e8d77c6">00058</a>   std::vector&lt;char*&gt; <a class="code" href="classCVC3_1_1ContextMemoryManager.html#a072fc7388a4d4ee1c9ab41e86e8d77c6">d_endChunkStack</a>;
<a name="l00059"></a>00059   <span class="comment">// Stack of indices into chunk vector</span>
<a name="l00060"></a><a class="code" href="classCVC3_1_1ContextMemoryManager.html#af9acbf2c1afccfe545df92a58e9640b5">00060</a>   std::vector&lt;unsigned&gt; <a class="code" href="classCVC3_1_1ContextMemoryManager.html#af9acbf2c1afccfe545df92a58e9640b5">d_indexChunkListStack</a>;
<a name="l00061"></a>00061 
<a name="l00062"></a>00062   <span class="comment">// Private methods</span>
<a name="l00063"></a><a class="code" href="classCVC3_1_1ContextMemoryManager.html#a39665b8435b77da4cea1c3edeb0bc1e4">00063</a>   <span class="keywordtype">void</span> <a class="code" href="classCVC3_1_1ContextMemoryManager.html#a39665b8435b77da4cea1c3edeb0bc1e4">newChunk</a>() { <span class="comment">// Allocate new chunk</span>
<a name="l00064"></a>00064     <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(<a class="code" href="classCVC3_1_1ContextMemoryManager.html#a804b2ca6c7df4db2ffe7893d2d642390">d_chunkList</a>.size() &gt; 0, <span class="stringliteral">&quot;expected unempty list&quot;</span>);
<a name="l00065"></a>00065     ++<a class="code" href="classCVC3_1_1ContextMemoryManager.html#a98cd8114b2fb756f54eb7adf8609d7ff">d_indexChunkList</a>;
<a name="l00066"></a>00066     <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(<a class="code" href="classCVC3_1_1ContextMemoryManager.html#a804b2ca6c7df4db2ffe7893d2d642390">d_chunkList</a>.size() == <a class="code" href="classCVC3_1_1ContextMemoryManager.html#a98cd8114b2fb756f54eb7adf8609d7ff">d_indexChunkList</a>, <span class="stringliteral">&quot;invariant violated&quot;</span>);
<a name="l00067"></a>00067     <span class="keywordflow">if</span> (<a class="code" href="classCVC3_1_1ContextMemoryManager.html#a5f5f52c997313f654d93e1f3d2dad128">s_freePages</a>.empty()) {
<a name="l00068"></a>00068       <a class="code" href="classCVC3_1_1ContextMemoryManager.html#a804b2ca6c7df4db2ffe7893d2d642390">d_chunkList</a>.push_back((<span class="keywordtype">char</span>*)malloc(<a class="code" href="namespaceCVC3.html#a4989066010e7e60055e399649ba6368c">chunkSizeBytes</a>));
<a name="l00069"></a>00069     }
<a name="l00070"></a>00070     <span class="keywordflow">else</span> {
<a name="l00071"></a>00071       <a class="code" href="classCVC3_1_1ContextMemoryManager.html#a804b2ca6c7df4db2ffe7893d2d642390">d_chunkList</a>.push_back(<a class="code" href="classCVC3_1_1ContextMemoryManager.html#a5f5f52c997313f654d93e1f3d2dad128">s_freePages</a>.back());
<a name="l00072"></a>00072       <a class="code" href="classCVC3_1_1ContextMemoryManager.html#a5f5f52c997313f654d93e1f3d2dad128">s_freePages</a>.pop_back();
<a name="l00073"></a>00073     }
<a name="l00074"></a>00074     <a class="code" href="classCVC3_1_1ContextMemoryManager.html#a169906c6e3ed4e95b0d596ee43b460c7">d_nextFree</a> = <a class="code" href="classCVC3_1_1ContextMemoryManager.html#a804b2ca6c7df4db2ffe7893d2d642390">d_chunkList</a>.back();
<a name="l00075"></a>00075     <a class="code" href="debug_8h.html#a2637b2fffa22e3c9fad40cda8fcc3bce" title="If something goes horribly wrong, print a message and abort immediately with exit(1).">FatalAssert</a>(<a class="code" href="classCVC3_1_1ContextMemoryManager.html#a169906c6e3ed4e95b0d596ee43b460c7">d_nextFree</a> != NULL, <span class="stringliteral">&quot;Out of memory&quot;</span>);
<a name="l00076"></a>00076     <a class="code" href="classCVC3_1_1ContextMemoryManager.html#a4550ccf98fb2409d0ab706090aacc932">d_endChunk</a> = <a class="code" href="classCVC3_1_1ContextMemoryManager.html#a169906c6e3ed4e95b0d596ee43b460c7">d_nextFree</a> + <a class="code" href="namespaceCVC3.html#a4989066010e7e60055e399649ba6368c">chunkSizeBytes</a>;
<a name="l00077"></a>00077   }
<a name="l00078"></a>00078 
<a name="l00079"></a>00079  <span class="keyword">public</span>:
<a name="l00080"></a>00080   <span class="comment">// Constructor</span>
<a name="l00081"></a><a class="code" href="classCVC3_1_1ContextMemoryManager.html#acfb95cb514e860aff1ec9a09830ae414">00081</a>   <a class="code" href="classCVC3_1_1ContextMemoryManager.html#acfb95cb514e860aff1ec9a09830ae414">ContextMemoryManager</a>()
<a name="l00082"></a>00082     : <a class="code" href="classCVC3_1_1ContextMemoryManager.html#a98cd8114b2fb756f54eb7adf8609d7ff">d_indexChunkList</a>(0)
<a name="l00083"></a>00083   {
<a name="l00084"></a>00084     <span class="keywordflow">if</span> (<a class="code" href="classCVC3_1_1ContextMemoryManager.html#a5f5f52c997313f654d93e1f3d2dad128">s_freePages</a>.empty()) {
<a name="l00085"></a>00085       <a class="code" href="classCVC3_1_1ContextMemoryManager.html#a804b2ca6c7df4db2ffe7893d2d642390">d_chunkList</a>.push_back((<span class="keywordtype">char</span>*)malloc(<a class="code" href="namespaceCVC3.html#a4989066010e7e60055e399649ba6368c">chunkSizeBytes</a>));
<a name="l00086"></a>00086     }
<a name="l00087"></a>00087     <span class="keywordflow">else</span> {
<a name="l00088"></a>00088       <a class="code" href="classCVC3_1_1ContextMemoryManager.html#a804b2ca6c7df4db2ffe7893d2d642390">d_chunkList</a>.push_back(<a class="code" href="classCVC3_1_1ContextMemoryManager.html#a5f5f52c997313f654d93e1f3d2dad128">s_freePages</a>.back());
<a name="l00089"></a>00089       <a class="code" href="classCVC3_1_1ContextMemoryManager.html#a5f5f52c997313f654d93e1f3d2dad128">s_freePages</a>.pop_back();
<a name="l00090"></a>00090     }      
<a name="l00091"></a>00091     <a class="code" href="classCVC3_1_1ContextMemoryManager.html#a169906c6e3ed4e95b0d596ee43b460c7">d_nextFree</a> = <a class="code" href="classCVC3_1_1ContextMemoryManager.html#a804b2ca6c7df4db2ffe7893d2d642390">d_chunkList</a>.back();
<a name="l00092"></a>00092     <a class="code" href="debug_8h.html#a2637b2fffa22e3c9fad40cda8fcc3bce" title="If something goes horribly wrong, print a message and abort immediately with exit(1).">FatalAssert</a>(<a class="code" href="classCVC3_1_1ContextMemoryManager.html#a169906c6e3ed4e95b0d596ee43b460c7">d_nextFree</a> != NULL, <span class="stringliteral">&quot;Out of memory&quot;</span>);
<a name="l00093"></a>00093     <a class="code" href="classCVC3_1_1ContextMemoryManager.html#a4550ccf98fb2409d0ab706090aacc932">d_endChunk</a> = <a class="code" href="classCVC3_1_1ContextMemoryManager.html#a169906c6e3ed4e95b0d596ee43b460c7">d_nextFree</a> + <a class="code" href="namespaceCVC3.html#a4989066010e7e60055e399649ba6368c">chunkSizeBytes</a>;
<a name="l00094"></a>00094   }
<a name="l00095"></a>00095 
<a name="l00096"></a>00096   <span class="comment">// Destructor</span>
<a name="l00097"></a><a class="code" href="classCVC3_1_1ContextMemoryManager.html#a682d563d0b923216799ff763bcc9afb1">00097</a>   <a class="code" href="classCVC3_1_1ContextMemoryManager.html#a682d563d0b923216799ff763bcc9afb1">~ContextMemoryManager</a>() {
<a name="l00098"></a>00098     <span class="keywordflow">while</span>(!<a class="code" href="classCVC3_1_1ContextMemoryManager.html#a804b2ca6c7df4db2ffe7893d2d642390">d_chunkList</a>.empty()) {
<a name="l00099"></a>00099       <a class="code" href="classCVC3_1_1ContextMemoryManager.html#a5f5f52c997313f654d93e1f3d2dad128">s_freePages</a>.push_back(<a class="code" href="classCVC3_1_1ContextMemoryManager.html#a804b2ca6c7df4db2ffe7893d2d642390">d_chunkList</a>.back());
<a name="l00100"></a>00100       <a class="code" href="classCVC3_1_1ContextMemoryManager.html#a804b2ca6c7df4db2ffe7893d2d642390">d_chunkList</a>.pop_back();
<a name="l00101"></a>00101     }
<a name="l00102"></a>00102   }
<a name="l00103"></a>00103 
<a name="l00104"></a><a class="code" href="classCVC3_1_1ContextMemoryManager.html#ab807ca47a879f81db74ff0bdcd54836c">00104</a>   <span class="keywordtype">void</span>* <a class="code" href="classCVC3_1_1ContextMemoryManager.html#ab807ca47a879f81db74ff0bdcd54836c">newData</a>(<span class="keywordtype">size_t</span> size) {
<a name="l00105"></a>00105     <span class="keywordtype">void</span>* res = (<span class="keywordtype">void</span>*)<a class="code" href="classCVC3_1_1ContextMemoryManager.html#a169906c6e3ed4e95b0d596ee43b460c7">d_nextFree</a>;
<a name="l00106"></a>00106     <a class="code" href="classCVC3_1_1ContextMemoryManager.html#a169906c6e3ed4e95b0d596ee43b460c7">d_nextFree</a> += size;
<a name="l00107"></a>00107     <span class="keywordflow">if</span> (<a class="code" href="classCVC3_1_1ContextMemoryManager.html#a169906c6e3ed4e95b0d596ee43b460c7">d_nextFree</a> &gt; <a class="code" href="classCVC3_1_1ContextMemoryManager.html#a4550ccf98fb2409d0ab706090aacc932">d_endChunk</a>) {
<a name="l00108"></a>00108       <a class="code" href="classCVC3_1_1ContextMemoryManager.html#a39665b8435b77da4cea1c3edeb0bc1e4">newChunk</a>();
<a name="l00109"></a>00109       res = (<span class="keywordtype">void</span>*)<a class="code" href="classCVC3_1_1ContextMemoryManager.html#a169906c6e3ed4e95b0d596ee43b460c7">d_nextFree</a>;
<a name="l00110"></a>00110       <a class="code" href="classCVC3_1_1ContextMemoryManager.html#a169906c6e3ed4e95b0d596ee43b460c7">d_nextFree</a> += size;
<a name="l00111"></a>00111       <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(<a class="code" href="classCVC3_1_1ContextMemoryManager.html#a169906c6e3ed4e95b0d596ee43b460c7">d_nextFree</a> &lt;= <a class="code" href="classCVC3_1_1ContextMemoryManager.html#a4550ccf98fb2409d0ab706090aacc932">d_endChunk</a>, <span class="stringliteral">&quot;chunk not big enough&quot;</span>);
<a name="l00112"></a>00112     }
<a name="l00113"></a>00113     <span class="keywordflow">return</span> res;
<a name="l00114"></a>00114   }
<a name="l00115"></a>00115 
<a name="l00116"></a><a class="code" href="classCVC3_1_1ContextMemoryManager.html#a1d56171712c9b2752f26fbcd59c719fb">00116</a>   <span class="keywordtype">void</span> <a class="code" href="classCVC3_1_1ContextMemoryManager.html#a1d56171712c9b2752f26fbcd59c719fb">deleteData</a>(<span class="keywordtype">void</span>* d) { }
<a name="l00117"></a>00117 
<a name="l00118"></a><a class="code" href="classCVC3_1_1ContextMemoryManager.html#a6ddc10ec7b4601984e8b8cb2d7490758">00118</a>   <span class="keywordtype">void</span> <a class="code" href="classCVC3_1_1ContextMemoryManager.html#a6ddc10ec7b4601984e8b8cb2d7490758">push</a>() {
<a name="l00119"></a>00119     <a class="code" href="classCVC3_1_1ContextMemoryManager.html#ac1a646d90c65cb8cccae99783282ce98">d_nextFreeStack</a>.push_back(<a class="code" href="classCVC3_1_1ContextMemoryManager.html#a169906c6e3ed4e95b0d596ee43b460c7">d_nextFree</a>);
<a name="l00120"></a>00120     <a class="code" href="classCVC3_1_1ContextMemoryManager.html#a072fc7388a4d4ee1c9ab41e86e8d77c6">d_endChunkStack</a>.push_back(<a class="code" href="classCVC3_1_1ContextMemoryManager.html#a4550ccf98fb2409d0ab706090aacc932">d_endChunk</a>);
<a name="l00121"></a>00121     <a class="code" href="classCVC3_1_1ContextMemoryManager.html#af9acbf2c1afccfe545df92a58e9640b5">d_indexChunkListStack</a>.push_back(<a class="code" href="classCVC3_1_1ContextMemoryManager.html#a98cd8114b2fb756f54eb7adf8609d7ff">d_indexChunkList</a>);
<a name="l00122"></a>00122   }
<a name="l00123"></a>00123 
<a name="l00124"></a><a class="code" href="classCVC3_1_1ContextMemoryManager.html#aa5e3be22f8255467351992c64d97a7a7">00124</a>   <span class="keywordtype">void</span> <a class="code" href="classCVC3_1_1ContextMemoryManager.html#aa5e3be22f8255467351992c64d97a7a7">pop</a>() {
<a name="l00125"></a>00125     <a class="code" href="classCVC3_1_1ContextMemoryManager.html#a169906c6e3ed4e95b0d596ee43b460c7">d_nextFree</a> = <a class="code" href="classCVC3_1_1ContextMemoryManager.html#ac1a646d90c65cb8cccae99783282ce98">d_nextFreeStack</a>.back();
<a name="l00126"></a>00126     <a class="code" href="classCVC3_1_1ContextMemoryManager.html#ac1a646d90c65cb8cccae99783282ce98">d_nextFreeStack</a>.pop_back();
<a name="l00127"></a>00127     <a class="code" href="classCVC3_1_1ContextMemoryManager.html#a4550ccf98fb2409d0ab706090aacc932">d_endChunk</a> = <a class="code" href="classCVC3_1_1ContextMemoryManager.html#a072fc7388a4d4ee1c9ab41e86e8d77c6">d_endChunkStack</a>.back();
<a name="l00128"></a>00128     <a class="code" href="classCVC3_1_1ContextMemoryManager.html#a072fc7388a4d4ee1c9ab41e86e8d77c6">d_endChunkStack</a>.pop_back();
<a name="l00129"></a>00129     <span class="keywordflow">while</span> (<a class="code" href="classCVC3_1_1ContextMemoryManager.html#a98cd8114b2fb756f54eb7adf8609d7ff">d_indexChunkList</a> &gt; <a class="code" href="classCVC3_1_1ContextMemoryManager.html#af9acbf2c1afccfe545df92a58e9640b5">d_indexChunkListStack</a>.back()) {
<a name="l00130"></a>00130       <a class="code" href="classCVC3_1_1ContextMemoryManager.html#a5f5f52c997313f654d93e1f3d2dad128">s_freePages</a>.push_back(<a class="code" href="classCVC3_1_1ContextMemoryManager.html#a804b2ca6c7df4db2ffe7893d2d642390">d_chunkList</a>.back());
<a name="l00131"></a>00131       <a class="code" href="classCVC3_1_1ContextMemoryManager.html#a804b2ca6c7df4db2ffe7893d2d642390">d_chunkList</a>.pop_back();
<a name="l00132"></a>00132       --<a class="code" href="classCVC3_1_1ContextMemoryManager.html#a98cd8114b2fb756f54eb7adf8609d7ff">d_indexChunkList</a>;
<a name="l00133"></a>00133     }
<a name="l00134"></a>00134     <a class="code" href="classCVC3_1_1ContextMemoryManager.html#af9acbf2c1afccfe545df92a58e9640b5">d_indexChunkListStack</a>.pop_back();
<a name="l00135"></a>00135   }
<a name="l00136"></a>00136 
<a name="l00137"></a><a class="code" href="classCVC3_1_1ContextMemoryManager.html#a887d1956727aeef95a09305d6e0cee7c">00137</a>   <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classCVC3_1_1ContextMemoryManager.html#a887d1956727aeef95a09305d6e0cee7c">garbageCollect</a>(<span class="keywordtype">void</span>) {
<a name="l00138"></a>00138     <span class="keywordflow">while</span> (!<a class="code" href="classCVC3_1_1ContextMemoryManager.html#a5f5f52c997313f654d93e1f3d2dad128">s_freePages</a>.empty()) {
<a name="l00139"></a>00139       free(<a class="code" href="classCVC3_1_1ContextMemoryManager.html#a5f5f52c997313f654d93e1f3d2dad128">s_freePages</a>.back());
<a name="l00140"></a>00140       <a class="code" href="classCVC3_1_1ContextMemoryManager.html#a5f5f52c997313f654d93e1f3d2dad128">s_freePages</a>.pop_back();
<a name="l00141"></a>00141     }
<a name="l00142"></a>00142   }
<a name="l00143"></a>00143 
<a name="l00144"></a><a class="code" href="classCVC3_1_1ContextMemoryManager.html#a816cc4ac96c301a0b3db4ccf3564f465">00144</a>   <span class="keywordtype">unsigned</span> <a class="code" href="classCVC3_1_1ContextMemoryManager.html#a816cc4ac96c301a0b3db4ccf3564f465">getMemory</a>(<span class="keywordtype">int</span> verbosity) {
<a name="l00145"></a>00145     <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> memSelf = <span class="keyword">sizeof</span>(<a class="code" href="classCVC3_1_1ContextMemoryManager.html#acfb95cb514e860aff1ec9a09830ae414">ContextMemoryManager</a>);
<a name="l00146"></a>00146     <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> mem = 0;
<a name="l00147"></a>00147 
<a name="l00148"></a>00148     mem += <a class="code" href="classCVC3_1_1MemoryTracker.html#a4f1cc78055cb2899adc927c2c26da9bc">MemoryTracker::getVec</a>(verbosity - 1, <a class="code" href="classCVC3_1_1ContextMemoryManager.html#a804b2ca6c7df4db2ffe7893d2d642390">d_chunkList</a>);
<a name="l00149"></a>00149     mem += <a class="code" href="classCVC3_1_1MemoryTracker.html#a4f1cc78055cb2899adc927c2c26da9bc">MemoryTracker::getVec</a>(verbosity - 1, <a class="code" href="classCVC3_1_1ContextMemoryManager.html#ac1a646d90c65cb8cccae99783282ce98">d_nextFreeStack</a>);
<a name="l00150"></a>00150     mem += <a class="code" href="classCVC3_1_1MemoryTracker.html#a4f1cc78055cb2899adc927c2c26da9bc">MemoryTracker::getVec</a>(verbosity - 1, <a class="code" href="classCVC3_1_1ContextMemoryManager.html#a072fc7388a4d4ee1c9ab41e86e8d77c6">d_endChunkStack</a>);
<a name="l00151"></a>00151     mem += <a class="code" href="classCVC3_1_1MemoryTracker.html#a4f1cc78055cb2899adc927c2c26da9bc">MemoryTracker::getVec</a>(verbosity - 1, <a class="code" href="classCVC3_1_1ContextMemoryManager.html#af9acbf2c1afccfe545df92a58e9640b5">d_indexChunkListStack</a>);
<a name="l00152"></a>00152 
<a name="l00153"></a>00153     mem += <a class="code" href="classCVC3_1_1ContextMemoryManager.html#a804b2ca6c7df4db2ffe7893d2d642390">d_chunkList</a>.size() * <a class="code" href="namespaceCVC3.html#a4989066010e7e60055e399649ba6368c">chunkSizeBytes</a>;
<a name="l00154"></a>00154 
<a name="l00155"></a>00155     <a class="code" href="classCVC3_1_1MemoryTracker.html#a689b66f3be59b607f35a67238817b9d0">MemoryTracker::print</a>(<span class="stringliteral">&quot;ContextMemoryManager&quot;</span>, verbosity, memSelf, mem);
<a name="l00156"></a>00156 
<a name="l00157"></a>00157     <span class="keywordflow">return</span> mem + memSelf;
<a name="l00158"></a>00158   }
<a name="l00159"></a>00159 
<a name="l00160"></a><a class="code" href="classCVC3_1_1ContextMemoryManager.html#ae104e086ca2d2fb2d6f04645ee98c5d7">00160</a>   <span class="keyword">static</span> <span class="keywordtype">unsigned</span> <a class="code" href="classCVC3_1_1ContextMemoryManager.html#ae104e086ca2d2fb2d6f04645ee98c5d7">getStaticMemory</a>(<span class="keywordtype">int</span> verbosity) {
<a name="l00161"></a>00161     <span class="keywordtype">unsigned</span> mem = 0;
<a name="l00162"></a>00162     mem += <a class="code" href="classCVC3_1_1MemoryTracker.html#a4f1cc78055cb2899adc927c2c26da9bc">MemoryTracker::getVec</a>(verbosity - 1, <a class="code" href="classCVC3_1_1ContextMemoryManager.html#a5f5f52c997313f654d93e1f3d2dad128">s_freePages</a>);
<a name="l00163"></a>00163     mem += <a class="code" href="classCVC3_1_1ContextMemoryManager.html#a5f5f52c997313f654d93e1f3d2dad128">s_freePages</a>.size() * <a class="code" href="namespaceCVC3.html#a4989066010e7e60055e399649ba6368c">chunkSizeBytes</a>;
<a name="l00164"></a>00164     <a class="code" href="classCVC3_1_1MemoryTracker.html#a689b66f3be59b607f35a67238817b9d0">MemoryTracker::print</a>(<span class="stringliteral">&quot;ContextMemoryManager Static&quot;</span>, verbosity, 0, mem);
<a name="l00165"></a>00165     <span class="keywordflow">return</span> mem;
<a name="l00166"></a>00166   }
<a name="l00167"></a>00167 
<a name="l00168"></a>00168 }; <span class="comment">// end of class ContextMemoryManager</span>
<a name="l00169"></a>00169 
<a name="l00170"></a>00170 }
<a name="l00171"></a>00171 
<a name="l00172"></a>00172 <span class="preprocessor">#endif</span>
</pre></div></div>
</div>
<hr class="footer"/><address class="footer"><small>Generated on Wed Sep 7 2011 for CVC3 by&#160;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
</body>
</html>