<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> <title>The MRPT project: memory.h File Reference</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> <link href="tabs.css" rel="stylesheet" type="text/css"> </head><body> <div align="left"><a href="http://www.mrpt.org/">Main MRPT website</a> > <b>C++ reference</b> </div> <div align="right"> <a href="index.html"><img border="0" src="mrpt_logo.png" alt="MRPT logo"></a> </div> <!-- Generated by Doxygen 1.6.2-20100208 --> <script type="text/javascript"><!-- var searchBox = new SearchBox("searchBox", "search",false,'Search'); --></script> <div class="navigation" id="top"> <div class="tabs"> <ul> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="pages.html"><span>Related Pages</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> <li> <div id="MSearchBox" class="MSearchBoxInactive"> <img id="MSearchSelect" src="search/search.png" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" alt=""/> <input type="text" id="MSearchField" value="Search" accesskey="S" onfocus="searchBox.OnSearchFieldFocus(true)" onblur="searchBox.OnSearchFieldFocus(false)" onkeyup="searchBox.OnSearchFieldChange(event)"/> <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a> </div> </li> </ul> </div> <div class="tabs"> <ul> <li><a href="files.html"><span>File List</span></a></li> <li><a href="globals.html"><span>File Members</span></a></li> </ul> </div> </div> <div class="contents"> <h1>memory.h File Reference</h1><code>#include <<a class="el" href="utils__defs_8h_source.html">mrpt/utils/utils_defs.h</a>></code><br/> <div class="dynheader"> Include dependency graph for memory.h:</div> <div class="dynsection"> <div class="center"><img src="memory_8h__incl.png" border="0" usemap="#memory_8h_map" alt=""/></div> <map name="memory_8h_map" id="memory_8h"> <area shape="rect" id="node3" href="utils__defs_8h.html" title="mrpt/utils/utils_defs.h" alt="" coords="1352,83,1499,112"/><area shape="rect" id="node7" href="os_8h.html" title="mrpt/system/os.h" alt="" coords="317,160,440,189"/><area shape="rect" id="node20" href="base_2include_2mrpt_2base_2link__pragmas_8h.html" title="mrpt/base/link_pragmas.h" alt="" coords="820,392,991,421"/><area shape="rect" id="node23" href="boost__join_8h.html" title="mrpt/utils/boost_join.h" alt="" coords="1152,469,1301,499"/><area shape="rect" id="node25" href="types_8h.html" title="mrpt/utils/types.h" alt="" coords="515,237,637,267"/><area shape="rect" id="node83" href="smart__ptr_8hpp.html" title="mrpt/otherlibs/stlplus/smart_ptr.hpp" alt="" coords="1052,160,1279,189"/><area shape="rect" id="node38" href="pstdint_8h.html" title="pstdint.h" alt="" coords="384,315,456,344"/><area shape="rect" id="node46" href="math__frwds_8h.html" title="mrpt/math/math_frwds.h" alt="" coords="480,315,643,344"/><area shape="rect" id="node85" href="containers__fixes_8hpp.html" title="containers_fixes.hpp" alt="" coords="1320,315,1461,344"/><area shape="rect" id="node87" href="exceptions_8hpp.html" title="exceptions.hpp" alt="" coords="1203,237,1312,267"/><area shape="rect" id="node94" href="atomic__incr_8h.html" title="mrpt/synch/atomic_incr.h" alt="" coords="949,315,1117,344"/><area shape="rect" id="node98" href="smart__ptr_8tpp.html" title="smart_ptr.tpp" alt="" coords="1029,237,1128,267"/></map> </div> <div class="dynheader"> This graph shows which files directly or indirectly include this file:</div> <div class="dynsection"> <div class="center"><img src="memory_8h__dep__incl.png" border="0" usemap="#memory_8hdep_map" alt=""/></div> <map name="memory_8hdep_map" id="memory_8hdep"> <area shape="rect" id="node3" href="_c_matrix_template_8h.html" title="CMatrixTemplate.h" alt="" coords="883,83,1016,112"/><area shape="rect" id="node161" href="system_8h.html" title="system.h" alt="" coords="3503,83,3577,112"/><area shape="rect" id="node5" href="_c_matrix_template_numeric_8h.html" title="CMatrixTemplateNumeric.h" alt="" coords="1099,160,1280,189"/><area shape="rect" id="node30" href="_c_generalized_cylinder_8h.html" title="CGeneralizedCylinder.h" alt="" coords="172,624,332,653"/><area shape="rect" id="node33" href="_c_angular_observation_mesh_8h.html" title="CAngularObservationMesh.h" alt="" coords="356,624,545,653"/><area shape="rect" id="node106" href="_c_config_file_base_8h.html" title="CConfigFileBase.h" alt="" coords="2821,392,2952,421"/><area shape="rect" id="node146" href="_c_robotic_head_interface_8h.html" title="CRoboticHeadInterface.h" alt="" coords="2476,469,2647,499"/><area shape="rect" id="node151" href="_c_matrix_template_objects_8h.html" title="CMatrixTemplateObjects.h" alt="" coords="195,315,373,344"/><area shape="rect" id="node155" href="_c_binary_relation_8h.html" title="CBinaryRelation.h" alt="" coords="647,160,775,189"/><area shape="rect" id="node7" href="_c_kalman_filter_capable_8h.html" title="CKalmanFilterCapable.h" alt="" coords="1369,547,1532,576"/><area shape="rect" id="node9" href="_c_range_bearing_k_f_s_l_a_m_8h.html" title="CRangeBearingKFSLAM.h" alt="" coords="1397,856,1576,885"/><area shape="rect" id="node11" href="_c_range_bearing_k_f_s_l_a_m2_d_8h.html" title="CRangeBearingKFSLAM2D.h" alt="" coords="2027,856,2221,885"/><area shape="rect" id="node13" href="_c_vector_template_8h.html" title="CVectorTemplate.h" alt="" coords="1227,237,1360,267"/><area shape="rect" id="node16" href="base_2include_2mrpt_2math_2utils_8h.html" title="utils.h" alt="" coords="1137,469,1193,499"/><area shape="rect" id="node27" href="geometry_8h.html" title="geometry.h" alt="" coords="237,547,323,576"/><area shape="rect" id="node37" href="ops__vectors_8h.html" title="ops_vectors.h" alt="" coords="1268,392,1372,421"/><area shape="rect" id="node41" href="_c_matrix_8h.html" title="CMatrix.h" alt="" coords="1069,315,1147,344"/><area shape="rect" id="node43" href="ops__matrices_8h.html" title="This file implements miscelaneous matrix and matrix/vector operations, plus internal..." alt="" coords="1591,392,1700,421"/><area shape="rect" id="node46" href="_random_generators_8h.html" title="RandomGenerators.h" alt="" coords="1607,469,1753,499"/><area shape="rect" id="node48" href="distributions_8h.html" title="distributions.h" alt="" coords="1431,469,1532,499"/><area shape="rect" id="node51" href="transform__gaussian_8h.html" title="transform_gaussian.h" alt="" coords="1828,469,1975,499"/><area shape="rect" id="node55" href="_c_canvas_8h.html" title="CCanvas.h" alt="" coords="1999,469,2087,499"/><area shape="rect" id="node57" href="_c_image_float_8h.html" title="CImageFloat.h" alt="" coords="2009,547,2116,576"/><area shape="rect" id="node62" href="_c_matrix_d_8h.html" title="CMatrixD.h" alt="" coords="1627,315,1715,344"/><area shape="rect" id="node68" href="_c_quaternion_8h.html" title="CQuaternion.h" alt="" coords="795,315,901,344"/><area shape="rect" id="node71" href="fourier_8h.html" title="fourier.h" alt="" coords="925,315,995,344"/><area shape="rect" id="node74" href="_c_matrix_b_8h.html" title="CMatrixB.h" alt="" coords="757,392,845,421"/><area shape="rect" id="node90" href="_c_pose_p_d_f_8h.html" title="CPosePDF.h" alt="" coords="571,237,669,267"/><area shape="rect" id="node92" href="_c_pose_random_sampler_8h.html" title="CPoseRandomSampler.h" alt="" coords="499,315,669,344"/><area shape="rect" id="node100" href="_t_camera_8h.html" title="TCamera.h" alt="" coords="2364,547,2449,576"/><area shape="rect" id="node102" href="_c_display_window_plots_8h.html" title="CDisplayWindowPlots.h" alt="" coords="989,237,1152,267"/><area shape="rect" id="node19" href="math__mrpt_8h.html" title="math_mrpt.h" alt="" coords="1119,624,1212,653"/><area shape="rect" id="node21" href="base_8h.html" title="base.h" alt="" coords="1492,701,1553,731"/><area shape="rect" id="node23" href="opengl_8h.html" title="opengl.h" alt="" coords="1488,779,1557,808"/><area shape="rect" id="node35" href="maps_8h.html" title="maps.h" alt="" coords="419,701,483,731"/><area shape="rect" id="node60" href="_c_consistent_observation_alignment_8h.html" title="CConsistentObservationAlignment.h" alt="" coords="499,392,733,421"/><area shape="rect" id="node108" href="_c_loadable_options_8h.html" title="CLoadableOptions.h" alt="" coords="2263,469,2401,499"/><area shape="rect" id="node114" href="_c_config_file_8h.html" title="CConfigFile.h" alt="" coords="3351,469,3452,499"/><area shape="rect" id="node116" href="_c_config_file_memory_8h.html" title="CConfigFileMemory.h" alt="" coords="3127,469,3276,499"/><area shape="rect" id="node118" href="_wx_utils_8h.html" title="WxUtils.h" alt="" coords="3361,547,3441,576"/><area shape="rect" id="node122" href="_c2_d_range_finder_abstract_8h.html" title="C2DRangeFinderAbstract.h" alt="" coords="3017,547,3199,576"/><area shape="rect" id="node126" href="_c_generic_sensor_8h.html" title="CGenericSensor.h" alt="" coords="2823,469,2951,499"/><area shape="rect" id="node129" href="_c_board_d_l_m_s_8h.html" title="CBoardDLMS.h" alt="" coords="3223,547,3337,576"/><area shape="rect" id="node132" href="_c_board_e_noses_8h.html" title="CBoardENoses.h" alt="" coords="2524,547,2647,576"/><area shape="rect" id="node135" href="_c_board_sonars_8h.html" title="CBoardSonars.h" alt="" coords="2671,547,2788,576"/><area shape="rect" id="node138" href="_c_camera_sensor_8h.html" title="CCameraSensor.h" alt="" coords="2863,547,2993,576"/><area shape="rect" id="node124" href="hwdrivers_8h.html" title="hwdrivers.h" alt="" coords="2781,624,2869,653"/><area shape="rect" id="node164" href="_c_h_m_t_s_l_a_m_8h.html" title="CHMTSLAM.h" alt="" coords="3577,160,3684,189"/><area shape="rect" id="node166" href="hmtslam_8h.html" title="hmtslam.h" alt="" coords="3589,237,3672,267"/></map> </div> <p><a href="memory_8h_source.html">Go to the source code of this file.</a></p> <table border="0" cellpadding="0" cellspacing="0"> <tr><td colspan="2"><h2>Namespaces</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top">namespace </td><td class="memItemRight" valign="bottom"><a class="el" href="namespacemrpt.html">mrpt</a></td></tr> <p><tr><td class="mdescLeft"> </td><td class="mdescRight"><p>This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries. </p> <br/></td></tr> </p> <tr><td class="memItemLeft" align="right" valign="top">namespace </td><td class="memItemRight" valign="bottom"><a class="el" href="namespacemrpt_1_1system.html">mrpt::system</a></td></tr> <p><tr><td class="mdescLeft"> </td><td class="mdescRight"><p>This namespace provides a OS-independent interface to many useful functions: filenames manipulation, time and date, string parsing, file I/O, threading, memory allocation, etc. </p> <br/></td></tr> </p> <tr><td class="memItemLeft" align="right" valign="top">namespace </td><td class="memItemRight" valign="bottom"><a class="el" href="namespacemrpt_1_1system_1_1os.html">mrpt::system::os</a></td></tr> <p><tr><td class="mdescLeft"> </td><td class="mdescRight"><p>This namespace provides a OS-independent interface to low-level functions. </p> <br/></td></tr> </p> <tr><td colspan="2"><h2>Defines</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="memory_8h.html#a773b27da13cd1f6538e738b7a84e38af">mrpt_alloca</a>(nBytes) ::malloc( nBytes );</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">In platforms and compilers with support to "alloca", allocate a memory block on the stack; if alloca is not supported, it is emulated as a normal "malloc" - NOTICE: Since in some platforms alloca will be emulated with malloc, alloca_free MUST BE ALWAYS CALLED to avoid memory leaks. <a href="#a773b27da13cd1f6538e738b7a84e38af"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="memory_8h.html#a12a8436a4cf3392c2f09a72348e7493c">mrpt_alloca_free</a>(mem_block) free(mem_block)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">This method must be called to "free" each memory block allocated with "system::alloca": If the block was really allocated in the stack, no operation is actually performed, otherwise it will be freed from the heap. <a href="#a12a8436a4cf3392c2f09a72348e7493c"></a><br/></td></tr> <tr><td colspan="2"><h2>Functions</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top">unsigned long BASE_IMPEXP </td><td class="memItemRight" valign="bottom"><a class="el" href="namespacemrpt_1_1system.html#a7a11bc87455d4f9872ec600738984bdb">mrpt::system::getMemoryUsage</a> ()</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Returns the memory occupied by this process, in bytes. <a href="#a7a11bc87455d4f9872ec600738984bdb"></a><br/></td></tr> <tr><td colspan="2"><div class="groupHeader">Aligned memory management</div></td></tr> <tr><td colspan="2"><div class="groupText"><p><a class="anchor" id="amgrp8e375805097f28ad15ae5f52036fa3fc"></a> </p> </div></td></tr> <tr><td class="memItemLeft" align="right" valign="top">void BASE_IMPEXP * </td><td class="memItemRight" valign="bottom"><a class="el" href="namespacemrpt_1_1system_1_1os.html#a40295c41a02e957fdfb7af5a747fec4e">mrpt::system::os::aligned_malloc</a> (size_t bytes, size_t alignment)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Returns an aligned memory block. <a href="#a40295c41a02e957fdfb7af5a747fec4e"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">void * </td><td class="memItemRight" valign="bottom"><a class="el" href="namespacemrpt_1_1system_1_1os.html#a1f0f740a33507bf943af5bac26e3abb0">mrpt::system::os::aligned_calloc</a> (size_t bytes, size_t alignment)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Identical to aligned_malloc, but it zeroes the reserved memory block. <a href="#a1f0f740a33507bf943af5bac26e3abb0"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">void BASE_IMPEXP * </td><td class="memItemRight" valign="bottom"><a class="el" href="namespacemrpt_1_1system_1_1os.html#aa0dd8ec272a9f40a191342057c185bd9">mrpt::system::os::aligned_realloc</a> (void *old_ptr, size_t bytes, size_t alignment)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Frees a memory block reserved by aligned_malloc. <a href="#aa0dd8ec272a9f40a191342057c185bd9"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">void BASE_IMPEXP </td><td class="memItemRight" valign="bottom"><a class="el" href="namespacemrpt_1_1system_1_1os.html#ab6aa729988ee1bd79ce4922b0bfc1f54">mrpt::system::os::aligned_free</a> (void *p)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Frees a memory block reserved by aligned_malloc. <a href="#ab6aa729988ee1bd79ce4922b0bfc1f54"></a><br/></td></tr> <tr><td class="memTemplParams" colspan="2">template<typename _Tp > </td></tr> <tr><td class="memTemplItemLeft" align="right" valign="top">_Tp * </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="namespacemrpt_1_1system_1_1os.html#a41115a1ea7e5524400748ed93f4249e4">mrpt::system::os::align_ptr</a> (_Tp *ptr, int n=(int) sizeof(_Tp))</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Returns a pointer a bit forward in memory so it's aligned for the given boundary size. <a href="#a41115a1ea7e5524400748ed93f4249e4"></a><br/></td></tr> </table> <hr/><h2>Define Documentation</h2> <a class="anchor" id="a773b27da13cd1f6538e738b7a84e38af"></a><!-- doxytag: member="memory.h::mrpt_alloca" ref="a773b27da13cd1f6538e738b7a84e38af" args="(nBytes)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define mrpt_alloca</td> <td>(</td> <td class="paramtype">nBytes </td> <td class="paramname"></td> <td> ) </td> <td> ::malloc( nBytes );</td> </tr> </table> </div> <div class="memdoc"> <p>In platforms and compilers with support to "alloca", allocate a memory block on the stack; if alloca is not supported, it is emulated as a normal "malloc" - NOTICE: Since in some platforms alloca will be emulated with malloc, alloca_free MUST BE ALWAYS CALLED to avoid memory leaks. </p> <p>This method MUST BE a macro rather than a function in order to operate on the caller's stack. </p> <dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="memory_8h.html#a12a8436a4cf3392c2f09a72348e7493c" title="This method must be called to "free" each memory block allocated with "system::alloca...">mrpt_alloca_free</a> </dd></dl> <p>Definition at line <a class="el" href="memory_8h_source.html#l00052">52</a> of file <a class="el" href="memory_8h_source.html">memory.h</a>.</p> </div> </div> <a class="anchor" id="a12a8436a4cf3392c2f09a72348e7493c"></a><!-- doxytag: member="memory.h::mrpt_alloca_free" ref="a12a8436a4cf3392c2f09a72348e7493c" args="(mem_block)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define mrpt_alloca_free</td> <td>(</td> <td class="paramtype">mem_block </td> <td class="paramname"></td> <td> ) </td> <td> free(mem_block)</td> </tr> </table> </div> <div class="memdoc"> <p>This method must be called to "free" each memory block allocated with "system::alloca": If the block was really allocated in the stack, no operation is actually performed, otherwise it will be freed from the heap. </p> <p>This method MUST BE a macro rather than a function in order to operate on the caller's stack. </p> <dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="memory_8h.html#a773b27da13cd1f6538e738b7a84e38af" title="In platforms and compilers with support to "alloca", allocate a memory...">mrpt_alloca</a> </dd></dl> <p>Definition at line <a class="el" href="memory_8h_source.html#l00067">67</a> of file <a class="el" href="memory_8h_source.html">memory.h</a>.</p> </div> </div> </div> <!--- window showing the filter options --> <div id="MSearchSelectWindow" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> <a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark"> </span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark"> </span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark"> </span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark"> </span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark"> </span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark"> </span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark"> </span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark"> </span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark"> </span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark"> </span>Friends</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(10)"><span class="SelectionMark"> </span>Defines</a></div> <!-- iframe showing the search results (closed by default) --> <div id="MSearchResultsWindow"> <iframe src="" frameborder="0" name="MSearchResults" id="MSearchResults"> </iframe> </div> <br><hr><br> <table border="0" width="100%"> <tr> <td> Page generated by <a href="http://www.doxygen.org" target="_blank">Doxygen 1.6.2-20100208</a> for MRPT 0.9.0 SVN: at Wed Jul 14 12:48:09 UTC 2010</td><td></td> <td width="100"> </td> <td width="150"> </td></tr> </table> </body></html>