<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://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"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <meta name="generator" content="Doxygen 1.8.18"/> <meta name="viewport" content="width=device-width, initial-scale=1"/> <title>AngelScript: Memory functions</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="dynsections.js"></script> <link href="navtree.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="resize.js"></script> <script type="text/javascript" src="navtreedata.js"></script> <script type="text/javascript" src="navtree.js"></script> <link href="search/search.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="search/searchdata.js"></script> <script type="text/javascript" src="search/search.js"></script> <script type="text/javascript"> /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */ $(document).ready(function() { init_search(); }); /* @license-end */ </script> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div, it is closed by doxygen! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td id="projectlogo"><img alt="Logo" src="aslogo_small.png"/></td> <td id="projectalign" style="padding-left: 0.5em;"> <div id="projectname">AngelScript </div> </td> <td> <div id="MSearchBox" class="MSearchBoxInactive"> <span class="left"> <img id="MSearchSelect" src="search/mag_sel.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)"/> </span><span class="right"> <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a> </span> </div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.18 --> <script type="text/javascript"> /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */ var searchBox = new SearchBox("searchBox", "search",false,'Search'); /* @license-end */ </script> </div><!-- top --> <div id="side-nav" class="ui-resizable side-nav-resizable"> <div id="nav-tree"> <div id="nav-tree-contents"> <div id="nav-sync" class="sync"></div> </div> </div> <div id="splitbar" style="-moz-user-select:none;" class="ui-resizable-handle"> </div> </div> <script type="text/javascript"> /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */ $(document).ready(function(){initNavTree('group__api__memory__functions.html',''); initResizable(); }); /* @license-end */ </script> <div id="doc-content"> <!-- window showing the filter options --> <div id="MSearchSelectWindow" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> </div> <!-- iframe showing the search results (closed by default) --> <div id="MSearchResultsWindow"> <iframe src="javascript:void(0)" frameborder="0" name="MSearchResults" id="MSearchResults"> </iframe> </div> <div class="header"> <div class="summary"> <a href="#func-members">Functions</a> </div> <div class="headertitle"> <div class="title">Memory functions</div> </div> </div><!--header--> <div class="contents"> <table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a> Functions</h2></td></tr> <tr class="memitem:ga527ab125defc58aa40cc151a25582a31"><td class="memItemLeft" align="right" valign="top"><a class="el" href="angelscript_8h.html#a6412a04ba6b2737922fdb2d8f822f51c">AS_API</a> int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__api__memory__functions.html#ga527ab125defc58aa40cc151a25582a31">asSetGlobalMemoryFunctions</a> (<a class="el" href="angelscript_8h.html#ac69a827822c73771cd972bff270cefc7">asALLOCFUNC_t</a> allocFunc, <a class="el" href="angelscript_8h.html#adeecc934971e695fc4441a47694860fb">asFREEFUNC_t</a> freeFunc)</td></tr> <tr class="memdesc:ga527ab125defc58aa40cc151a25582a31"><td class="mdescLeft"> </td><td class="mdescRight">Set the memory management functions that AngelScript should use. <a href="group__api__memory__functions.html#ga527ab125defc58aa40cc151a25582a31">More...</a><br /></td></tr> <tr class="separator:ga527ab125defc58aa40cc151a25582a31"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:ga9267c4ad35aceaf7cc0961cd42147ee7"><td class="memItemLeft" align="right" valign="top"><a class="el" href="angelscript_8h.html#a6412a04ba6b2737922fdb2d8f822f51c">AS_API</a> int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__api__memory__functions.html#ga9267c4ad35aceaf7cc0961cd42147ee7">asResetGlobalMemoryFunctions</a> ()</td></tr> <tr class="memdesc:ga9267c4ad35aceaf7cc0961cd42147ee7"><td class="mdescLeft"> </td><td class="mdescRight">Remove previously registered memory management functions. <a href="group__api__memory__functions.html#ga9267c4ad35aceaf7cc0961cd42147ee7">More...</a><br /></td></tr> <tr class="separator:ga9267c4ad35aceaf7cc0961cd42147ee7"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:ga54a201f99d19e648526abf30ae31e466"><td class="memItemLeft" align="right" valign="top"><a class="el" href="angelscript_8h.html#a6412a04ba6b2737922fdb2d8f822f51c">AS_API</a> void * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__api__memory__functions.html#ga54a201f99d19e648526abf30ae31e466">asAllocMem</a> (size_t size)</td></tr> <tr class="memdesc:ga54a201f99d19e648526abf30ae31e466"><td class="mdescLeft"> </td><td class="mdescRight">Allocate memory using the memory function registered with AngelScript. <a href="group__api__memory__functions.html#ga54a201f99d19e648526abf30ae31e466">More...</a><br /></td></tr> <tr class="separator:ga54a201f99d19e648526abf30ae31e466"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:ga9da61275bbfd5f7bd55ed411d05fe103"><td class="memItemLeft" align="right" valign="top"><a class="el" href="angelscript_8h.html#a6412a04ba6b2737922fdb2d8f822f51c">AS_API</a> void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__api__memory__functions.html#ga9da61275bbfd5f7bd55ed411d05fe103">asFreeMem</a> (void *mem)</td></tr> <tr class="memdesc:ga9da61275bbfd5f7bd55ed411d05fe103"><td class="mdescLeft"> </td><td class="mdescRight">Deallocates memory using the memory function registered with AngelScript. <a href="group__api__memory__functions.html#ga9da61275bbfd5f7bd55ed411d05fe103">More...</a><br /></td></tr> <tr class="separator:ga9da61275bbfd5f7bd55ed411d05fe103"><td class="memSeparator" colspan="2"> </td></tr> </table> <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2> <h2 class="groupheader">Function Documentation</h2> <a id="ga54a201f99d19e648526abf30ae31e466"></a> <h2 class="memtitle"><span class="permalink"><a href="#ga54a201f99d19e648526abf30ae31e466">◆ </a></span>asAllocMem()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="angelscript_8h.html#a6412a04ba6b2737922fdb2d8f822f51c">AS_API</a> void* asAllocMem </td> <td>(</td> <td class="paramtype">size_t </td> <td class="paramname"><em>size</em></td><td>)</td> <td></td> </tr> </table> </div><div class="memdoc"> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramdir">[in]</td><td class="paramname">size</td><td>The size of the buffer to allocate </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>A pointer to the allocated buffer, or null on error. </dd></dl> </div> </div> <a id="ga9da61275bbfd5f7bd55ed411d05fe103"></a> <h2 class="memtitle"><span class="permalink"><a href="#ga9da61275bbfd5f7bd55ed411d05fe103">◆ </a></span>asFreeMem()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="angelscript_8h.html#a6412a04ba6b2737922fdb2d8f822f51c">AS_API</a> void asFreeMem </td> <td>(</td> <td class="paramtype">void * </td> <td class="paramname"><em>mem</em></td><td>)</td> <td></td> </tr> </table> </div><div class="memdoc"> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramdir">[in]</td><td class="paramname">mem</td><td>A pointer to the buffer to deallocate </td></tr> </table> </dd> </dl> </div> </div> <a id="ga9267c4ad35aceaf7cc0961cd42147ee7"></a> <h2 class="memtitle"><span class="permalink"><a href="#ga9267c4ad35aceaf7cc0961cd42147ee7">◆ </a></span>asResetGlobalMemoryFunctions()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="angelscript_8h.html#a6412a04ba6b2737922fdb2d8f822f51c">AS_API</a> int asResetGlobalMemoryFunctions </td> <td>(</td> <td class="paramname"></td><td>)</td> <td></td> </tr> </table> </div><div class="memdoc"> <dl class="section return"><dt>Returns</dt><dd>A negative value on error.</dd></dl> <p>Call this method to restore the default memory management functions. </p> </div> </div> <a id="ga527ab125defc58aa40cc151a25582a31"></a> <h2 class="memtitle"><span class="permalink"><a href="#ga527ab125defc58aa40cc151a25582a31">◆ </a></span>asSetGlobalMemoryFunctions()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="angelscript_8h.html#a6412a04ba6b2737922fdb2d8f822f51c">AS_API</a> int asSetGlobalMemoryFunctions </td> <td>(</td> <td class="paramtype"><a class="el" href="angelscript_8h.html#ac69a827822c73771cd972bff270cefc7">asALLOCFUNC_t</a> </td> <td class="paramname"><em>allocFunc</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="angelscript_8h.html#adeecc934971e695fc4441a47694860fb">asFREEFUNC_t</a> </td> <td class="paramname"><em>freeFunc</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramdir">[in]</td><td class="paramname">allocFunc</td><td>The function that will be used to allocate memory. </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">freeFunc</td><td>The function that will be used to free the memory. </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>A negative value on error.</dd></dl> <p>Call this method to register the global memory allocation and deallocation functions that AngelScript should use for memory management. This function should be called before <a class="el" href="group__api__principal__functions.html#gacb6a62345d9cca6c9b5a3dac67d80d0b">asCreateScriptEngine</a>.</p> <p>If not called, AngelScript will use the malloc and free functions from the standard C library. </p> </div> </div> </div><!-- contents --> </div><!-- doc-content --> <!-- start footer part --> <div id="nav-path" class="navpath"><!-- id is needed for treeview function! --> <ul> <li class="footer">Generated on Sat Dec 5 2020 23:20:25 for AngelScript by <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.18 </li> </ul> </div> </body> </html>