123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714 |
- <!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.17"/>
- <meta name="viewport" content="width=device-width, initial-scale=1"/>
- <title>MQTT C Client Libraries Internals: Heap.c File Reference</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="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>
- <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="pahologo.png"/></td>
- <td id="projectalign" style="padding-left: 0.5em;">
- <div id="projectname">MQTT C Client Libraries Internals
- </div>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- <!-- end header part -->
- <!-- Generated by Doxygen 1.8.17 -->
- <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>
- <script type="text/javascript" src="menudata.js"></script>
- <script type="text/javascript" src="menu.js"></script>
- <script type="text/javascript">
- /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
- $(function() {
- initMenu('',true,false,'search.php','Search');
- $(document).ready(function() { init_search(); });
- });
- /* @license-end */</script>
- <div id="main-nav"></div>
- <!-- 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><!-- top -->
- <div class="header">
- <div class="summary">
- <a href="#nested-classes">Data Structures</a> |
- <a href="#typedef-members">Typedefs</a> |
- <a href="#func-members">Functions</a> |
- <a href="#var-members">Variables</a> </div>
- <div class="headertitle">
- <div class="title">Heap.c File Reference</div> </div>
- </div><!--header-->
- <div class="contents">
- <p>functions to manage the heap with the goal of eliminating memory leaks
- <a href="#details">More...</a></p>
- <div class="textblock"><code>#include "Tree.h"</code><br />
- <code>#include "Log.h"</code><br />
- <code>#include "StackTrace.h"</code><br />
- <code>#include "Thread.h"</code><br />
- <code>#include <stdlib.h></code><br />
- <code>#include <string.h></code><br />
- <code>#include <stdio.h></code><br />
- <code>#include <stddef.h></code><br />
- <code>#include "Heap.h"</code><br />
- </div><div class="textblock"><div class="dynheader">
- Include dependency graph for Heap.c:</div>
- <div class="dyncontent">
- <div class="center"><img src="Heap_8c__incl.png" border="0" usemap="#Heap_8c" alt=""/></div>
- <map name="Heap_8c" id="Heap_8c">
- <area shape="rect" title="functions to manage the heap with the goal of eliminating memory leaks" alt="" coords="136,5,199,32"/>
- <area shape="rect" title=" " alt="" coords="5,80,68,107"/>
- <area shape="rect" title=" " alt="" coords="93,80,157,107"/>
- <area shape="rect" title=" " alt="" coords="181,80,241,107"/>
- <area shape="rect" title=" " alt="" coords="265,80,333,107"/>
- </map>
- </div>
- </div><table class="memberdecls">
- <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
- Data Structures</h2></td></tr>
- <tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="structstorageElement.html">storageElement</a></td></tr>
- <tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">Each item on the heap is recorded with this structure. <a href="structstorageElement.html#details">More...</a><br /></td></tr>
- <tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
- </table><table class="memberdecls">
- <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="typedef-members"></a>
- Typedefs</h2></td></tr>
- <tr class="memitem:a5a8148d30974535c314932760924b44c"><td class="memItemLeft" align="right" valign="top"><a id="a5a8148d30974535c314932760924b44c"></a>
- typedef double </td><td class="memItemRight" valign="bottom"><b>eyecatcherType</b></td></tr>
- <tr class="separator:a5a8148d30974535c314932760924b44c"><td class="memSeparator" colspan="2"> </td></tr>
- </table><table class="memberdecls">
- <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
- Functions</h2></td></tr>
- <tr class="memitem:ae75b06db0cdfce5c281f8672e8577854"><td class="memItemLeft" align="right" valign="top">static size_t </td><td class="memItemRight" valign="bottom"><a class="el" href="Heap_8c.html#ae75b06db0cdfce5c281f8672e8577854">Heap_roundup</a> (size_t size)</td></tr>
- <tr class="memdesc:ae75b06db0cdfce5c281f8672e8577854"><td class="mdescLeft"> </td><td class="mdescRight">Round allocation size up to a multiple of the size of an int. <a href="Heap_8c.html#ae75b06db0cdfce5c281f8672e8577854">More...</a><br /></td></tr>
- <tr class="separator:ae75b06db0cdfce5c281f8672e8577854"><td class="memSeparator" colspan="2"> </td></tr>
- <tr class="memitem:a45db32d4f454f94d7f4574deced5ee33"><td class="memItemLeft" align="right" valign="top">static int </td><td class="memItemRight" valign="bottom"><a class="el" href="Heap_8c.html#a45db32d4f454f94d7f4574deced5ee33">ptrCompare</a> (void *a, void *b, int value)</td></tr>
- <tr class="memdesc:a45db32d4f454f94d7f4574deced5ee33"><td class="mdescLeft"> </td><td class="mdescRight"><a class="el" href="structList.html" title="Structure to hold all data for one list.">List</a> callback function for comparing storage elements. <a href="Heap_8c.html#a45db32d4f454f94d7f4574deced5ee33">More...</a><br /></td></tr>
- <tr class="separator:a45db32d4f454f94d7f4574deced5ee33"><td class="memSeparator" colspan="2"> </td></tr>
- <tr class="memitem:afa283972f1bf265ebe538e80198fb674"><td class="memItemLeft" align="right" valign="top"><a id="afa283972f1bf265ebe538e80198fb674"></a>
- static void </td><td class="memItemRight" valign="bottom"><b>checkEyecatchers</b> (char *file, int line, void *p, size_t size)</td></tr>
- <tr class="separator:afa283972f1bf265ebe538e80198fb674"><td class="memSeparator" colspan="2"> </td></tr>
- <tr class="memitem:ac23c370399a3c7b9aa9fa9d0672be122"><td class="memItemLeft" align="right" valign="top">static int </td><td class="memItemRight" valign="bottom"><a class="el" href="Heap_8c.html#ac23c370399a3c7b9aa9fa9d0672be122">Internal_heap_unlink</a> (char *file, int line, void *p)</td></tr>
- <tr class="memdesc:ac23c370399a3c7b9aa9fa9d0672be122"><td class="mdescLeft"> </td><td class="mdescRight">Remove an item from the recorded heap without actually freeing it. <a href="Heap_8c.html#ac23c370399a3c7b9aa9fa9d0672be122">More...</a><br /></td></tr>
- <tr class="separator:ac23c370399a3c7b9aa9fa9d0672be122"><td class="memSeparator" colspan="2"> </td></tr>
- <tr class="memitem:aafff91620a02cc5f8160ee55dc1d7bf4"><td class="memItemLeft" align="right" valign="top">static void </td><td class="memItemRight" valign="bottom"><a class="el" href="Heap_8c.html#aafff91620a02cc5f8160ee55dc1d7bf4">HeapScan</a> (enum LOG_LEVELS log_level)</td></tr>
- <tr class="memdesc:aafff91620a02cc5f8160ee55dc1d7bf4"><td class="mdescLeft"> </td><td class="mdescRight">Scans the heap and reports any items currently allocated. <a href="Heap_8c.html#aafff91620a02cc5f8160ee55dc1d7bf4">More...</a><br /></td></tr>
- <tr class="separator:aafff91620a02cc5f8160ee55dc1d7bf4"><td class="memSeparator" colspan="2"> </td></tr>
- <tr class="memitem:a59e53a989d69c3da767487596d9bfa1f"><td class="memItemLeft" align="right" valign="top">void * </td><td class="memItemRight" valign="bottom"><a class="el" href="Heap_8c.html#a59e53a989d69c3da767487596d9bfa1f">mymalloc</a> (char *file, int line, size_t size)</td></tr>
- <tr class="memdesc:a59e53a989d69c3da767487596d9bfa1f"><td class="mdescLeft"> </td><td class="mdescRight">Allocates a block of memory. <a href="Heap_8c.html#a59e53a989d69c3da767487596d9bfa1f">More...</a><br /></td></tr>
- <tr class="separator:a59e53a989d69c3da767487596d9bfa1f"><td class="memSeparator" colspan="2"> </td></tr>
- <tr class="memitem:a25214c297c998eba3cfc8282b1162c69"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="Heap_8c.html#a25214c297c998eba3cfc8282b1162c69">myfree</a> (char *file, int line, void *p)</td></tr>
- <tr class="memdesc:a25214c297c998eba3cfc8282b1162c69"><td class="mdescLeft"> </td><td class="mdescRight">Frees a block of memory. <a href="Heap_8c.html#a25214c297c998eba3cfc8282b1162c69">More...</a><br /></td></tr>
- <tr class="separator:a25214c297c998eba3cfc8282b1162c69"><td class="memSeparator" colspan="2"> </td></tr>
- <tr class="memitem:a5f453bffe39551109e282c904a6f2902"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="Heap_8c.html#a5f453bffe39551109e282c904a6f2902">Heap_unlink</a> (char *file, int line, void *p)</td></tr>
- <tr class="memdesc:a5f453bffe39551109e282c904a6f2902"><td class="mdescLeft"> </td><td class="mdescRight">Remove an item from the recorded heap without actually freeing it. <a href="Heap_8c.html#a5f453bffe39551109e282c904a6f2902">More...</a><br /></td></tr>
- <tr class="separator:a5f453bffe39551109e282c904a6f2902"><td class="memSeparator" colspan="2"> </td></tr>
- <tr class="memitem:a699e6722cc8f195f853f09ac274413a3"><td class="memItemLeft" align="right" valign="top">void * </td><td class="memItemRight" valign="bottom"><a class="el" href="Heap_8c.html#a699e6722cc8f195f853f09ac274413a3">myrealloc</a> (char *file, int line, void *p, size_t size)</td></tr>
- <tr class="memdesc:a699e6722cc8f195f853f09ac274413a3"><td class="mdescLeft"> </td><td class="mdescRight">Reallocates a block of memory. <a href="Heap_8c.html#a699e6722cc8f195f853f09ac274413a3">More...</a><br /></td></tr>
- <tr class="separator:a699e6722cc8f195f853f09ac274413a3"><td class="memSeparator" colspan="2"> </td></tr>
- <tr class="memitem:a0f10ff94faca02a6f81953c889802954"><td class="memItemLeft" align="right" valign="top">void * </td><td class="memItemRight" valign="bottom"><a class="el" href="Heap_8c.html#a0f10ff94faca02a6f81953c889802954">Heap_findItem</a> (void *p)</td></tr>
- <tr class="memdesc:a0f10ff94faca02a6f81953c889802954"><td class="mdescLeft"> </td><td class="mdescRight">Utility to find an item in the heap. <a href="Heap_8c.html#a0f10ff94faca02a6f81953c889802954">More...</a><br /></td></tr>
- <tr class="separator:a0f10ff94faca02a6f81953c889802954"><td class="memSeparator" colspan="2"> </td></tr>
- <tr class="memitem:a7fb8bd5f7469fc9c1e48c3a1f17de88a"><td class="memItemLeft" align="right" valign="top"><a id="a7fb8bd5f7469fc9c1e48c3a1f17de88a"></a>
- int </td><td class="memItemRight" valign="bottom"><a class="el" href="Heap_8c.html#a7fb8bd5f7469fc9c1e48c3a1f17de88a">Heap_initialize</a> (void)</td></tr>
- <tr class="memdesc:a7fb8bd5f7469fc9c1e48c3a1f17de88a"><td class="mdescLeft"> </td><td class="mdescRight">Heap initialization. <br /></td></tr>
- <tr class="separator:a7fb8bd5f7469fc9c1e48c3a1f17de88a"><td class="memSeparator" colspan="2"> </td></tr>
- <tr class="memitem:a669dfefa789daec52dd8ddc03ff1f9f9"><td class="memItemLeft" align="right" valign="top"><a id="a669dfefa789daec52dd8ddc03ff1f9f9"></a>
- void </td><td class="memItemRight" valign="bottom"><a class="el" href="Heap_8c.html#a669dfefa789daec52dd8ddc03ff1f9f9">Heap_terminate</a> (void)</td></tr>
- <tr class="memdesc:a669dfefa789daec52dd8ddc03ff1f9f9"><td class="mdescLeft"> </td><td class="mdescRight">Heap termination. <br /></td></tr>
- <tr class="separator:a669dfefa789daec52dd8ddc03ff1f9f9"><td class="memSeparator" colspan="2"> </td></tr>
- <tr class="memitem:a20faecf28cdd9d2fbf7d975c5b0863ef"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structheap__info.html">heap_info</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="Heap_8c.html#a20faecf28cdd9d2fbf7d975c5b0863ef">Heap_get_info</a> (void)</td></tr>
- <tr class="memdesc:a20faecf28cdd9d2fbf7d975c5b0863ef"><td class="mdescLeft"> </td><td class="mdescRight">Access to heap state. <a href="Heap_8c.html#a20faecf28cdd9d2fbf7d975c5b0863ef">More...</a><br /></td></tr>
- <tr class="separator:a20faecf28cdd9d2fbf7d975c5b0863ef"><td class="memSeparator" colspan="2"> </td></tr>
- <tr class="memitem:a6cdadd76da21b7269cf5d9fc92dedb68"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="Heap_8c.html#a6cdadd76da21b7269cf5d9fc92dedb68">HeapDumpString</a> (FILE *file, char *str)</td></tr>
- <tr class="memdesc:a6cdadd76da21b7269cf5d9fc92dedb68"><td class="mdescLeft"> </td><td class="mdescRight">Dump a string from the heap so that it can be displayed conveniently. <a href="Heap_8c.html#a6cdadd76da21b7269cf5d9fc92dedb68">More...</a><br /></td></tr>
- <tr class="separator:a6cdadd76da21b7269cf5d9fc92dedb68"><td class="memSeparator" colspan="2"> </td></tr>
- <tr class="memitem:aea7ea58998f69f14e16a3237c1d02d8a"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="Heap_8c.html#aea7ea58998f69f14e16a3237c1d02d8a">HeapDump</a> (FILE *file)</td></tr>
- <tr class="memdesc:aea7ea58998f69f14e16a3237c1d02d8a"><td class="mdescLeft"> </td><td class="mdescRight">Dump the state of the heap. <a href="Heap_8c.html#aea7ea58998f69f14e16a3237c1d02d8a">More...</a><br /></td></tr>
- <tr class="separator:aea7ea58998f69f14e16a3237c1d02d8a"><td class="memSeparator" colspan="2"> </td></tr>
- </table><table class="memberdecls">
- <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="var-members"></a>
- Variables</h2></td></tr>
- <tr class="memitem:a6533888772aaa3afdee6a16a1f197087"><td class="memItemLeft" align="right" valign="top"><a id="a6533888772aaa3afdee6a16a1f197087"></a>
- static pthread_mutex_t </td><td class="memItemRight" valign="bottom"><b>heap_mutex_store</b> = PTHREAD_MUTEX_INITIALIZER</td></tr>
- <tr class="separator:a6533888772aaa3afdee6a16a1f197087"><td class="memSeparator" colspan="2"> </td></tr>
- <tr class="memitem:af369074ecc039810e2beb121821f09a1"><td class="memItemLeft" align="right" valign="top"><a id="af369074ecc039810e2beb121821f09a1"></a>
- static mutex_type </td><td class="memItemRight" valign="bottom"><b>heap_mutex</b> = &heap_mutex_store</td></tr>
- <tr class="separator:af369074ecc039810e2beb121821f09a1"><td class="memSeparator" colspan="2"> </td></tr>
- <tr class="memitem:a20b83c8e52be131ca41d22b8bf2c3b38"><td class="memItemLeft" align="right" valign="top"><a id="a20b83c8e52be131ca41d22b8bf2c3b38"></a>
- static <a class="el" href="structheap__info.html">heap_info</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="Heap_8c.html#a20b83c8e52be131ca41d22b8bf2c3b38">state</a> = {0, 0}</td></tr>
- <tr class="memdesc:a20b83c8e52be131ca41d22b8bf2c3b38"><td class="mdescLeft"> </td><td class="mdescRight">global heap state information <br /></td></tr>
- <tr class="separator:a20b83c8e52be131ca41d22b8bf2c3b38"><td class="memSeparator" colspan="2"> </td></tr>
- <tr class="memitem:af6c32ed140099d88362891aa068bdd09"><td class="memItemLeft" align="right" valign="top"><a id="af6c32ed140099d88362891aa068bdd09"></a>
- static eyecatcherType </td><td class="memItemRight" valign="bottom"><b>eyecatcher</b> = (eyecatcherType)0x8888888888888888</td></tr>
- <tr class="separator:af6c32ed140099d88362891aa068bdd09"><td class="memSeparator" colspan="2"> </td></tr>
- <tr class="memitem:aa337931db6f2e3b78d5dce6a8d228257"><td class="memItemLeft" align="right" valign="top"><a id="aa337931db6f2e3b78d5dce6a8d228257"></a>
- static <a class="el" href="structTree.html">Tree</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="Heap_8c.html#aa337931db6f2e3b78d5dce6a8d228257">heap</a></td></tr>
- <tr class="memdesc:aa337931db6f2e3b78d5dce6a8d228257"><td class="mdescLeft"> </td><td class="mdescRight"><a class="el" href="structTree.html" title="Structure to hold all data for one tree.">Tree</a> that holds the allocation records. <br /></td></tr>
- <tr class="separator:aa337931db6f2e3b78d5dce6a8d228257"><td class="memSeparator" colspan="2"> </td></tr>
- <tr class="memitem:abf84b75eac9d1e64a468ca387683d350"><td class="memItemLeft" align="right" valign="top"><a id="abf84b75eac9d1e64a468ca387683d350"></a>
- static const char * </td><td class="memItemRight" valign="bottom"><b>errmsg</b> = "Memory allocation error"</td></tr>
- <tr class="separator:abf84b75eac9d1e64a468ca387683d350"><td class="memSeparator" colspan="2"> </td></tr>
- </table>
- <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
- <div class="textblock"><p>functions to manage the heap with the goal of eliminating memory leaks </p>
- <p>For any module to use these functions transparently, simply include the Heap.h header file. Malloc and free will be redefined, but will behave in exactly the same way as normal, so no recoding is necessary. </p>
- </div><h2 class="groupheader">Function Documentation</h2>
- <a id="a0f10ff94faca02a6f81953c889802954"></a>
- <h2 class="memtitle"><span class="permalink"><a href="#a0f10ff94faca02a6f81953c889802954">◆ </a></span>Heap_findItem()</h2>
- <div class="memitem">
- <div class="memproto">
- <table class="memname">
- <tr>
- <td class="memname">void* Heap_findItem </td>
- <td>(</td>
- <td class="paramtype">void * </td>
- <td class="paramname"><em>p</em></td><td>)</td>
- <td></td>
- </tr>
- </table>
- </div><div class="memdoc">
- <p>Utility to find an item in the heap. </p>
- <p>Lets you know if the heap already contains the memory location in question. </p><dl class="params"><dt>Parameters</dt><dd>
- <table class="params">
- <tr><td class="paramname">p</td><td>pointer to a memory location </td></tr>
- </table>
- </dd>
- </dl>
- <dl class="section return"><dt>Returns</dt><dd>pointer to the storage element if found, or NULL </dd></dl>
- <div class="dynheader">
- Here is the call graph for this function:</div>
- <div class="dyncontent">
- <div class="center"><img src="Heap_8c_a0f10ff94faca02a6f81953c889802954_cgraph.png" border="0" usemap="#Heap_8c_a0f10ff94faca02a6f81953c889802954_cgraph" alt=""/></div>
- <map name="Heap_8c_a0f10ff94faca02a6f81953c889802954_cgraph" id="Heap_8c_a0f10ff94faca02a6f81953c889802954_cgraph">
- <area shape="rect" title="Utility to find an item in the heap." alt="" coords="5,5,112,32"/>
- <area shape="rect" href="Thread_8c.html#a7e92185eb22775c76e1b6b8865468f17" title="Lock a mutex which has alrea." alt="" coords="160,5,295,32"/>
- </map>
- </div>
- </div>
- </div>
- <a id="a20faecf28cdd9d2fbf7d975c5b0863ef"></a>
- <h2 class="memtitle"><span class="permalink"><a href="#a20faecf28cdd9d2fbf7d975c5b0863ef">◆ </a></span>Heap_get_info()</h2>
- <div class="memitem">
- <div class="memproto">
- <table class="memname">
- <tr>
- <td class="memname"><a class="el" href="structheap__info.html">heap_info</a>* Heap_get_info </td>
- <td>(</td>
- <td class="paramtype">void </td>
- <td class="paramname"></td><td>)</td>
- <td></td>
- </tr>
- </table>
- </div><div class="memdoc">
- <p>Access to heap state. </p>
- <dl class="section return"><dt>Returns</dt><dd>pointer to the heap state structure </dd></dl>
- </div>
- </div>
- <a id="ae75b06db0cdfce5c281f8672e8577854"></a>
- <h2 class="memtitle"><span class="permalink"><a href="#ae75b06db0cdfce5c281f8672e8577854">◆ </a></span>Heap_roundup()</h2>
- <div class="memitem">
- <div class="memproto">
- <table class="mlabels">
- <tr>
- <td class="mlabels-left">
- <table class="memname">
- <tr>
- <td class="memname">static size_t Heap_roundup </td>
- <td>(</td>
- <td class="paramtype">size_t </td>
- <td class="paramname"><em>size</em></td><td>)</td>
- <td></td>
- </tr>
- </table>
- </td>
- <td class="mlabels-right">
- <span class="mlabels"><span class="mlabel">static</span></span> </td>
- </tr>
- </table>
- </div><div class="memdoc">
- <p>Round allocation size up to a multiple of the size of an int. </p>
- <p>Apart from possibly reducing fragmentation, on the old v3 gcc compilers I was hitting some weird behaviour, which might have been errors in sizeof() used on structures and related to packing. In any case, this fixes that too. </p><dl class="params"><dt>Parameters</dt><dd>
- <table class="params">
- <tr><td class="paramname">size</td><td>the size actually needed </td></tr>
- </table>
- </dd>
- </dl>
- <dl class="section return"><dt>Returns</dt><dd>the rounded up size </dd></dl>
- </div>
- </div>
- <a id="a5f453bffe39551109e282c904a6f2902"></a>
- <h2 class="memtitle"><span class="permalink"><a href="#a5f453bffe39551109e282c904a6f2902">◆ </a></span>Heap_unlink()</h2>
- <div class="memitem">
- <div class="memproto">
- <table class="memname">
- <tr>
- <td class="memname">void Heap_unlink </td>
- <td>(</td>
- <td class="paramtype">char * </td>
- <td class="paramname"><em>file</em>, </td>
- </tr>
- <tr>
- <td class="paramkey"></td>
- <td></td>
- <td class="paramtype">int </td>
- <td class="paramname"><em>line</em>, </td>
- </tr>
- <tr>
- <td class="paramkey"></td>
- <td></td>
- <td class="paramtype">void * </td>
- <td class="paramname"><em>p</em> </td>
- </tr>
- <tr>
- <td></td>
- <td>)</td>
- <td></td><td></td>
- </tr>
- </table>
- </div><div class="memdoc">
- <p>Remove an item from the recorded heap without actually freeing it. </p>
- <p>Use sparingly! </p><dl class="params"><dt>Parameters</dt><dd>
- <table class="params">
- <tr><td class="paramname">file</td><td>use the <b>FILE</b> macro to indicate which file this item was allocated in </td></tr>
- <tr><td class="paramname">line</td><td>use the <b>LINE</b> macro to indicate which line this item was allocated at </td></tr>
- <tr><td class="paramname">p</td><td>pointer to the item to be removed </td></tr>
- </table>
- </dd>
- </dl>
- <div class="dynheader">
- Here is the call graph for this function:</div>
- <div class="dyncontent">
- <div class="center"><img src="Heap_8c_a5f453bffe39551109e282c904a6f2902_cgraph.png" border="0" usemap="#Heap_8c_a5f453bffe39551109e282c904a6f2902_cgraph" alt=""/></div>
- <map name="Heap_8c_a5f453bffe39551109e282c904a6f2902_cgraph" id="Heap_8c_a5f453bffe39551109e282c904a6f2902_cgraph">
- <area shape="rect" title="Remove an item from the recorded heap without actually freeing it." alt="" coords="5,5,100,32"/>
- <area shape="rect" href="Thread_8c.html#a7e92185eb22775c76e1b6b8865468f17" title="Lock a mutex which has alrea." alt="" coords="148,5,283,32"/>
- </map>
- </div>
- </div>
- </div>
- <a id="aea7ea58998f69f14e16a3237c1d02d8a"></a>
- <h2 class="memtitle"><span class="permalink"><a href="#aea7ea58998f69f14e16a3237c1d02d8a">◆ </a></span>HeapDump()</h2>
- <div class="memitem">
- <div class="memproto">
- <table class="memname">
- <tr>
- <td class="memname">int HeapDump </td>
- <td>(</td>
- <td class="paramtype">FILE * </td>
- <td class="paramname"><em>file</em></td><td>)</td>
- <td></td>
- </tr>
- </table>
- </div><div class="memdoc">
- <p>Dump the state of the heap. </p>
- <dl class="params"><dt>Parameters</dt><dd>
- <table class="params">
- <tr><td class="paramname">file</td><td>file handle to dump the heap contents to </td></tr>
- </table>
- </dd>
- </dl>
- </div>
- </div>
- <a id="a6cdadd76da21b7269cf5d9fc92dedb68"></a>
- <h2 class="memtitle"><span class="permalink"><a href="#a6cdadd76da21b7269cf5d9fc92dedb68">◆ </a></span>HeapDumpString()</h2>
- <div class="memitem">
- <div class="memproto">
- <table class="memname">
- <tr>
- <td class="memname">int HeapDumpString </td>
- <td>(</td>
- <td class="paramtype">FILE * </td>
- <td class="paramname"><em>file</em>, </td>
- </tr>
- <tr>
- <td class="paramkey"></td>
- <td></td>
- <td class="paramtype">char * </td>
- <td class="paramname"><em>str</em> </td>
- </tr>
- <tr>
- <td></td>
- <td>)</td>
- <td></td><td></td>
- </tr>
- </table>
- </div><div class="memdoc">
- <p>Dump a string from the heap so that it can be displayed conveniently. </p>
- <dl class="params"><dt>Parameters</dt><dd>
- <table class="params">
- <tr><td class="paramname">file</td><td>file handle to dump the heap contents to </td></tr>
- <tr><td class="paramname">str</td><td>the string to dump, could be NULL </td></tr>
- </table>
- </dd>
- </dl>
- </div>
- </div>
- <a id="aafff91620a02cc5f8160ee55dc1d7bf4"></a>
- <h2 class="memtitle"><span class="permalink"><a href="#aafff91620a02cc5f8160ee55dc1d7bf4">◆ </a></span>HeapScan()</h2>
- <div class="memitem">
- <div class="memproto">
- <table class="mlabels">
- <tr>
- <td class="mlabels-left">
- <table class="memname">
- <tr>
- <td class="memname">static void HeapScan </td>
- <td>(</td>
- <td class="paramtype">enum LOG_LEVELS </td>
- <td class="paramname"><em>log_level</em></td><td>)</td>
- <td></td>
- </tr>
- </table>
- </td>
- <td class="mlabels-right">
- <span class="mlabels"><span class="mlabel">static</span></span> </td>
- </tr>
- </table>
- </div><div class="memdoc">
- <p>Scans the heap and reports any items currently allocated. </p>
- <p>To be used at shutdown if any heap items have not been freed. </p>
- <div class="dynheader">
- Here is the call graph for this function:</div>
- <div class="dyncontent">
- <div class="center"><img src="Heap_8c_aafff91620a02cc5f8160ee55dc1d7bf4_cgraph.png" border="0" usemap="#Heap_8c_aafff91620a02cc5f8160ee55dc1d7bf4_cgraph" alt=""/></div>
- <map name="Heap_8c_aafff91620a02cc5f8160ee55dc1d7bf4_cgraph" id="Heap_8c_aafff91620a02cc5f8160ee55dc1d7bf4_cgraph">
- <area shape="rect" title="Scans the heap and reports any items currently allocated." alt="" coords="5,5,88,32"/>
- <area shape="rect" href="Thread_8c.html#a7e92185eb22775c76e1b6b8865468f17" title="Lock a mutex which has alrea." alt="" coords="136,5,271,32"/>
- </map>
- </div>
- </div>
- </div>
- <a id="ac23c370399a3c7b9aa9fa9d0672be122"></a>
- <h2 class="memtitle"><span class="permalink"><a href="#ac23c370399a3c7b9aa9fa9d0672be122">◆ </a></span>Internal_heap_unlink()</h2>
- <div class="memitem">
- <div class="memproto">
- <table class="mlabels">
- <tr>
- <td class="mlabels-left">
- <table class="memname">
- <tr>
- <td class="memname">static int Internal_heap_unlink </td>
- <td>(</td>
- <td class="paramtype">char * </td>
- <td class="paramname"><em>file</em>, </td>
- </tr>
- <tr>
- <td class="paramkey"></td>
- <td></td>
- <td class="paramtype">int </td>
- <td class="paramname"><em>line</em>, </td>
- </tr>
- <tr>
- <td class="paramkey"></td>
- <td></td>
- <td class="paramtype">void * </td>
- <td class="paramname"><em>p</em> </td>
- </tr>
- <tr>
- <td></td>
- <td>)</td>
- <td></td><td></td>
- </tr>
- </table>
- </td>
- <td class="mlabels-right">
- <span class="mlabels"><span class="mlabel">static</span></span> </td>
- </tr>
- </table>
- </div><div class="memdoc">
- <p>Remove an item from the recorded heap without actually freeing it. </p>
- <p>Use sparingly! </p><dl class="params"><dt>Parameters</dt><dd>
- <table class="params">
- <tr><td class="paramname">file</td><td>use the <b>FILE</b> macro to indicate which file this item was allocated in </td></tr>
- <tr><td class="paramname">line</td><td>use the <b>LINE</b> macro to indicate which line this item was allocated at </td></tr>
- <tr><td class="paramname">p</td><td>pointer to the item to be removed </td></tr>
- </table>
- </dd>
- </dl>
- </div>
- </div>
- <a id="a25214c297c998eba3cfc8282b1162c69"></a>
- <h2 class="memtitle"><span class="permalink"><a href="#a25214c297c998eba3cfc8282b1162c69">◆ </a></span>myfree()</h2>
- <div class="memitem">
- <div class="memproto">
- <table class="memname">
- <tr>
- <td class="memname">void myfree </td>
- <td>(</td>
- <td class="paramtype">char * </td>
- <td class="paramname"><em>file</em>, </td>
- </tr>
- <tr>
- <td class="paramkey"></td>
- <td></td>
- <td class="paramtype">int </td>
- <td class="paramname"><em>line</em>, </td>
- </tr>
- <tr>
- <td class="paramkey"></td>
- <td></td>
- <td class="paramtype">void * </td>
- <td class="paramname"><em>p</em> </td>
- </tr>
- <tr>
- <td></td>
- <td>)</td>
- <td></td><td></td>
- </tr>
- </table>
- </div><div class="memdoc">
- <p>Frees a block of memory. </p>
- <p>A direct replacement for free, but checks that a item is in the allocates list first. </p><dl class="params"><dt>Parameters</dt><dd>
- <table class="params">
- <tr><td class="paramname">file</td><td>use the <b>FILE</b> macro to indicate which file this item was allocated in </td></tr>
- <tr><td class="paramname">line</td><td>use the <b>LINE</b> macro to indicate which line this item was allocated at </td></tr>
- <tr><td class="paramname">p</td><td>pointer to the item to be freed </td></tr>
- </table>
- </dd>
- </dl>
- <div class="dynheader">
- Here is the call graph for this function:</div>
- <div class="dyncontent">
- <div class="center"><img src="Heap_8c_a25214c297c998eba3cfc8282b1162c69_cgraph.png" border="0" usemap="#Heap_8c_a25214c297c998eba3cfc8282b1162c69_cgraph" alt=""/></div>
- <map name="Heap_8c_a25214c297c998eba3cfc8282b1162c69_cgraph" id="Heap_8c_a25214c297c998eba3cfc8282b1162c69_cgraph">
- <area shape="rect" title="Frees a block of memory." alt="" coords="5,5,67,32"/>
- <area shape="rect" href="Thread_8c.html#a7e92185eb22775c76e1b6b8865468f17" title="Lock a mutex which has alrea." alt="" coords="115,5,249,32"/>
- </map>
- </div>
- </div>
- </div>
- <a id="a59e53a989d69c3da767487596d9bfa1f"></a>
- <h2 class="memtitle"><span class="permalink"><a href="#a59e53a989d69c3da767487596d9bfa1f">◆ </a></span>mymalloc()</h2>
- <div class="memitem">
- <div class="memproto">
- <table class="memname">
- <tr>
- <td class="memname">void* mymalloc </td>
- <td>(</td>
- <td class="paramtype">char * </td>
- <td class="paramname"><em>file</em>, </td>
- </tr>
- <tr>
- <td class="paramkey"></td>
- <td></td>
- <td class="paramtype">int </td>
- <td class="paramname"><em>line</em>, </td>
- </tr>
- <tr>
- <td class="paramkey"></td>
- <td></td>
- <td class="paramtype">size_t </td>
- <td class="paramname"><em>size</em> </td>
- </tr>
- <tr>
- <td></td>
- <td>)</td>
- <td></td><td></td>
- </tr>
- </table>
- </div><div class="memdoc">
- <p>Allocates a block of memory. </p>
- <p>A direct replacement for malloc, but keeps track of items allocated in a list, so that free can check that a item is being freed correctly and that we can check that all memory is freed at shutdown. </p><dl class="params"><dt>Parameters</dt><dd>
- <table class="params">
- <tr><td class="paramname">file</td><td>use the <b>FILE</b> macro to indicate which file this item was allocated in </td></tr>
- <tr><td class="paramname">line</td><td>use the <b>LINE</b> macro to indicate which line this item was allocated at </td></tr>
- <tr><td class="paramname">size</td><td>the size of the item to be allocated </td></tr>
- </table>
- </dd>
- </dl>
- <dl class="section return"><dt>Returns</dt><dd>pointer to the allocated item, or NULL if there was an error </dd></dl>
- <div class="dynheader">
- Here is the call graph for this function:</div>
- <div class="dyncontent">
- <div class="center"><img src="Heap_8c_a59e53a989d69c3da767487596d9bfa1f_cgraph.png" border="0" usemap="#Heap_8c_a59e53a989d69c3da767487596d9bfa1f_cgraph" alt=""/></div>
- <map name="Heap_8c_a59e53a989d69c3da767487596d9bfa1f_cgraph" id="Heap_8c_a59e53a989d69c3da767487596d9bfa1f_cgraph">
- <area shape="rect" title="Allocates a block of memory." alt="" coords="5,5,83,32"/>
- <area shape="rect" href="Thread_8c.html#a7e92185eb22775c76e1b6b8865468f17" title="Lock a mutex which has alrea." alt="" coords="131,5,265,32"/>
- </map>
- </div>
- </div>
- </div>
- <a id="a699e6722cc8f195f853f09ac274413a3"></a>
- <h2 class="memtitle"><span class="permalink"><a href="#a699e6722cc8f195f853f09ac274413a3">◆ </a></span>myrealloc()</h2>
- <div class="memitem">
- <div class="memproto">
- <table class="memname">
- <tr>
- <td class="memname">void* myrealloc </td>
- <td>(</td>
- <td class="paramtype">char * </td>
- <td class="paramname"><em>file</em>, </td>
- </tr>
- <tr>
- <td class="paramkey"></td>
- <td></td>
- <td class="paramtype">int </td>
- <td class="paramname"><em>line</em>, </td>
- </tr>
- <tr>
- <td class="paramkey"></td>
- <td></td>
- <td class="paramtype">void * </td>
- <td class="paramname"><em>p</em>, </td>
- </tr>
- <tr>
- <td class="paramkey"></td>
- <td></td>
- <td class="paramtype">size_t </td>
- <td class="paramname"><em>size</em> </td>
- </tr>
- <tr>
- <td></td>
- <td>)</td>
- <td></td><td></td>
- </tr>
- </table>
- </div><div class="memdoc">
- <p>Reallocates a block of memory. </p>
- <p>A direct replacement for realloc, but keeps track of items allocated in a list, so that free can check that a item is being freed correctly and that we can check that all memory is freed at shutdown. We have to remove the item from the tree, as the memory is in order and so it needs to be reinserted in the correct place. </p><dl class="params"><dt>Parameters</dt><dd>
- <table class="params">
- <tr><td class="paramname">file</td><td>use the <b>FILE</b> macro to indicate which file this item was reallocated in </td></tr>
- <tr><td class="paramname">line</td><td>use the <b>LINE</b> macro to indicate which line this item was reallocated at </td></tr>
- <tr><td class="paramname">p</td><td>pointer to the item to be reallocated </td></tr>
- <tr><td class="paramname">size</td><td>the new size of the item </td></tr>
- </table>
- </dd>
- </dl>
- <dl class="section return"><dt>Returns</dt><dd>pointer to the allocated item, or NULL if there was an error </dd></dl>
- <div class="dynheader">
- Here is the call graph for this function:</div>
- <div class="dyncontent">
- <div class="center"><img src="Heap_8c_a699e6722cc8f195f853f09ac274413a3_cgraph.png" border="0" usemap="#Heap_8c_a699e6722cc8f195f853f09ac274413a3_cgraph" alt=""/></div>
- <map name="Heap_8c_a699e6722cc8f195f853f09ac274413a3_cgraph" id="Heap_8c_a699e6722cc8f195f853f09ac274413a3_cgraph">
- <area shape="rect" title="Reallocates a block of memory." alt="" coords="5,5,83,32"/>
- <area shape="rect" href="Thread_8c.html#a7e92185eb22775c76e1b6b8865468f17" title="Lock a mutex which has alrea." alt="" coords="131,5,265,32"/>
- </map>
- </div>
- </div>
- </div>
- <a id="a45db32d4f454f94d7f4574deced5ee33"></a>
- <h2 class="memtitle"><span class="permalink"><a href="#a45db32d4f454f94d7f4574deced5ee33">◆ </a></span>ptrCompare()</h2>
- <div class="memitem">
- <div class="memproto">
- <table class="mlabels">
- <tr>
- <td class="mlabels-left">
- <table class="memname">
- <tr>
- <td class="memname">static int ptrCompare </td>
- <td>(</td>
- <td class="paramtype">void * </td>
- <td class="paramname"><em>a</em>, </td>
- </tr>
- <tr>
- <td class="paramkey"></td>
- <td></td>
- <td class="paramtype">void * </td>
- <td class="paramname"><em>b</em>, </td>
- </tr>
- <tr>
- <td class="paramkey"></td>
- <td></td>
- <td class="paramtype">int </td>
- <td class="paramname"><em>value</em> </td>
- </tr>
- <tr>
- <td></td>
- <td>)</td>
- <td></td><td></td>
- </tr>
- </table>
- </td>
- <td class="mlabels-right">
- <span class="mlabels"><span class="mlabel">static</span></span> </td>
- </tr>
- </table>
- </div><div class="memdoc">
- <p><a class="el" href="structList.html" title="Structure to hold all data for one list.">List</a> callback function for comparing storage elements. </p>
- <dl class="params"><dt>Parameters</dt><dd>
- <table class="params">
- <tr><td class="paramname">a</td><td>pointer to the current content in the tree (storageElement*) </td></tr>
- <tr><td class="paramname">b</td><td>pointer to the memory to free </td></tr>
- </table>
- </dd>
- </dl>
- <dl class="section return"><dt>Returns</dt><dd>boolean indicating whether a and b are equal </dd></dl>
- </div>
- </div>
- </div><!-- contents -->
- <!-- start footer part -->
- <hr class="footer"/><address class="footer"><small>
- Generated on Thu Sep 29 2022 11:34:46 for MQTT C Client Libraries Internals by  <a href="http://www.doxygen.org/index.html">
- <img class="footer" src="doxygen.png" alt="doxygen"/>
- </a> 1.8.17
- </small></address>
- </body>
- </html>
|