📄 glib-memory-chunks.html
字号:
<a class="link" href="glib-Memory-Chunks.html#G-ALLOC-ONLY:CAPS"><span class="type">G_ALLOC_ONLY</span></a> should be used if atoms will never be freed individually.<a class="link" href="glib-Memory-Chunks.html#G-ALLOC-ONLY:CAPS"><span class="type">G_ALLOC_ONLY</span></a> is quicker, since it does not need to track free atoms,but it obviously wastes memory if you no longer need many of the atoms.</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>the new <a class="link" href="glib-Memory-Chunks.html#GMemChunk"><span class="type">GMemChunk</span></a>.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3234447"></a><h3><a name="g-chunk-new"></a>g_chunk_new()</h3><a class="indexterm" name="id3234462"></a><pre class="programlisting">#define g_chunk_new(type, chunk)</pre><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p><code class="literal">g_chunk_new</code> has been deprecated since version 2.10 and should not be used in newly-written code. Use <a class="link" href="glib-Memory-Slices.html#g-slice-new"><code class="function">g_slice_new()</code></a> instead</p></div><p>A convenience macro to allocate an atom of memory from a <a class="link" href="glib-Memory-Chunks.html#GMemChunk"><span class="type">GMemChunk</span></a>.It calls <a class="link" href="glib-Memory-Chunks.html#g-mem-chunk-alloc"><code class="function">g_mem_chunk_alloc()</code></a> and casts the returned atom to a pointer tothe given type, avoiding a type cast in the source code.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>type</code></em> :</span></p></td><td>the type of the <a class="link" href="glib-Memory-Chunks.html#GMemChunk"><span class="type">GMemChunk</span></a> atoms, typically a structure name.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>chunk</code></em> :</span></p></td><td>a <a class="link" href="glib-Memory-Chunks.html#GMemChunk"><span class="type">GMemChunk</span></a>.</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>a pointer to the allocated atom, cast to a pointer to <em class="parameter"><code>type</code></em>.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3234587"></a><h3><a name="g-chunk-new0"></a>g_chunk_new0()</h3><a class="indexterm" name="id3234602"></a><pre class="programlisting">#define g_chunk_new0(type, chunk)</pre><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p><code class="literal">g_chunk_new0</code> has been deprecated since version 2.10 and should not be used in newly-written code. Use <a class="link" href="glib-Memory-Slices.html#g-slice-new0"><code class="function">g_slice_new0()</code></a> instead</p></div><p>A convenience macro to allocate an atom of memory from a <a class="link" href="glib-Memory-Chunks.html#GMemChunk"><span class="type">GMemChunk</span></a>.It calls <a class="link" href="glib-Memory-Chunks.html#g-mem-chunk-alloc0"><code class="function">g_mem_chunk_alloc0()</code></a> and casts the returned atom to a pointer tothe given type, avoiding a type cast in the source code.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>type</code></em> :</span></p></td><td>the type of the <a class="link" href="glib-Memory-Chunks.html#GMemChunk"><span class="type">GMemChunk</span></a> atoms, typically a structure name.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>chunk</code></em> :</span></p></td><td>a <a class="link" href="glib-Memory-Chunks.html#GMemChunk"><span class="type">GMemChunk</span></a>.</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>a pointer to the allocated atom, cast to a pointer to <em class="parameter"><code>type</code></em>.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3234728"></a><h3><a name="g-chunk-free"></a>g_chunk_free()</h3><a class="indexterm" name="id3234743"></a><pre class="programlisting">#define g_chunk_free(mem, mem_chunk)</pre><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p><code class="literal">g_chunk_free</code> has been deprecated since version 2.10 and should not be used in newly-written code. Use <a class="link" href="glib-Memory-Slices.html#g-slice-free"><code class="function">g_slice_free()</code></a> instead</p></div><p>A convenience macro to free an atom of memory from a <a class="link" href="glib-Memory-Chunks.html#GMemChunk"><span class="type">GMemChunk</span></a>.It simply switches the arguments and calls <a class="link" href="glib-Memory-Chunks.html#g-mem-chunk-free"><code class="function">g_mem_chunk_free()</code></a>It is included simply to complement the other convenience macros, <a class="link" href="glib-Memory-Chunks.html#g-chunk-new"><code class="function">g_chunk_new()</code></a>and <a class="link" href="glib-Memory-Chunks.html#g-chunk-new0"><code class="function">g_chunk_new0()</code></a>.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>mem</code></em> :</span></p></td><td>a pointer to the atom to be freed.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>mem_chunk</code></em> :</span></p></td><td>a <a class="link" href="glib-Memory-Chunks.html#GMemChunk"><span class="type">GMemChunk</span></a>.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3234864"></a><h3><a name="g-mem-chunk-reset"></a>g_mem_chunk_reset ()</h3><a class="indexterm" name="id3234879"></a><pre class="programlisting">void g_mem_chunk_reset (<a class="link" href="glib-Memory-Chunks.html#GMemChunk">GMemChunk</a> *mem_chunk);</pre><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p><code class="literal">g_mem_chunk_reset</code> has been deprecated since version 2.10 and should not be used in newly-written code. Use the <a class="link" href="glib-Memory-Slices.html" title="Memory Slices">slice allocator</a> instead</p></div><p>Resets a GMemChunk to its initial state.It frees all of the currently allocated blocks of memory.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>mem_chunk</code></em> :</span></p></td><td>a <a class="link" href="glib-Memory-Chunks.html#GMemChunk"><span class="type">GMemChunk</span></a>.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3234955"></a><h3><a name="g-mem-chunk-clean"></a>g_mem_chunk_clean ()</h3><a class="indexterm" name="id3234970"></a><pre class="programlisting">void g_mem_chunk_clean (<a class="link" href="glib-Memory-Chunks.html#GMemChunk">GMemChunk</a> *mem_chunk);</pre><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p><code class="literal">g_mem_chunk_clean</code> has been deprecated since version 2.10 and should not be used in newly-written code. Use the <a class="link" href="glib-Memory-Slices.html" title="Memory Slices">slice allocator</a> instead</p></div><p>Frees any blocks in a <a class="link" href="glib-Memory-Chunks.html#GMemChunk"><span class="type">GMemChunk</span></a> which are no longer being used.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>mem_chunk</code></em> :</span></p></td><td>a <a class="link" href="glib-Memory-Chunks.html#GMemChunk"><span class="type">GMemChunk</span></a>.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3235053"></a><h3><a name="g-blow-chunks"></a>g_blow_chunks ()</h3><a class="indexterm" name="id3235067"></a><pre class="programlisting">void g_blow_chunks (void);</pre><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p><code class="literal">g_blow_chunks</code> has been deprecated since version 2.10 and should not be used in newly-written code. Use the <a class="link" href="glib-Memory-Slices.html" title="Memory Slices">slice allocator</a> instead</p></div><p>Calls <a class="link" href="glib-Memory-Chunks.html#g-mem-chunk-clean"><code class="function">g_mem_chunk_clean()</code></a> on all <a class="link" href="glib-Memory-Chunks.html#GMemChunk"><span class="type">GMemChunk</span></a> objects.</p></div><hr><div class="refsect2" lang="en"><a name="id3235128"></a><h3><a name="g-mem-chunk-info"></a>g_mem_chunk_info ()</h3><a class="indexterm" name="id3235143"></a><pre class="programlisting">void g_mem_chunk_info (void);</pre><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p><code class="literal">g_mem_chunk_info</code> has been deprecated since version 2.10 and should not be used in newly-written code. Use the <a class="link" href="glib-Memory-Slices.html" title="Memory Slices">slice allocator</a> instead</p></div><p>Outputs debugging information for all <a class="link" href="glib-Memory-Chunks.html#GMemChunk"><span class="type">GMemChunk</span></a> objects currently in use.It outputs the number of <a class="link" href="glib-Memory-Chunks.html#GMemChunk"><span class="type">GMemChunk</span></a> objects currently allocated,and calls <a class="link" href="glib-Memory-Chunks.html#g-mem-chunk-print"><code class="function">g_mem_chunk_print()</code></a> to output information on each one.</p></div><hr><div class="refsect2" lang="en"><a name="id3235214"></a><h3><a name="g-mem-chunk-print"></a>g_mem_chunk_print ()</h3><a class="indexterm" name="id3235229"></a><pre class="programlisting">void g_mem_chunk_print (<a class="link" href="glib-Memory-Chunks.html#GMemChunk">GMemChunk</a> *mem_chunk);</pre><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p><code class="literal">g_mem_chunk_print</code> has been deprecated since version 2.10 and should not be used in newly-written code. Use the <a class="link" href="glib-Memory-Slices.html" title="Memory Slices">slice allocator</a> instead</p></div><p>Outputs debugging information for a <a class="link" href="glib-Memory-Chunks.html#GMemChunk"><span class="type">GMemChunk</span></a>.It outputs the name of the <a class="link" href="glib-Memory-Chunks.html#GMemChunk"><span class="type">GMemChunk</span></a> (set with <a class="link" href="glib-Memory-Chunks.html#g-mem-chunk-new"><code class="function">g_mem_chunk_new()</code></a>),the number of bytes used, and the number of blocks of memory allocated.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>mem_chunk</code></em> :</span></p></td><td>a <a class="link" href="glib-Memory-Chunks.html#GMemChunk"><span class="type">GMemChunk</span></a>.</td></tr></tbody></table></div></div></div><div class="refsect1" lang="en"><a name="id3235333"></a><div class="refsect2" lang="en"><a name="id3235334"></a></div><hr><div class="refsect2" lang="en"><a name="id3235335"></a></div></div></div></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -