⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 glib-memory-chunks.html

📁 最新gtk中文资料集
💻 HTML
📖 第 1 页 / 共 3 页
字号:
<a class="indexterm" name="id3233397"></a><pre class="programlisting">#define G_ALLOC_AND_FREE  2</pre><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p><code class="literal">G_ALLOC_AND_FREE</code> is deprecated and should not be used in newly-written code.</p></div><p>Specifies the type of a <a class="link" href="glib-Memory-Chunks.html#GMemChunk"><span class="type">GMemChunk</span></a>.Used in <a class="link" href="glib-Memory-Chunks.html#g-mem-chunk-new"><code class="function">g_mem_chunk_new()</code></a> and <a class="link" href="glib-Memory-Chunks.html#g-mem-chunk-create"><code class="function">g_mem_chunk_create()</code></a> to specify that atomswill be freed individually.</p></div><hr><div class="refsect2" lang="en"><a name="id3233456"></a><h3><a name="G-ALLOC-ONLY:CAPS"></a>G_ALLOC_ONLY</h3><a class="indexterm" name="id3233470"></a><pre class="programlisting">#define G_ALLOC_ONLY	  1</pre><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p><code class="literal">G_ALLOC_ONLY</code> is deprecated and should not be used in newly-written code.</p></div><p>Specifies the type of a <a class="link" href="glib-Memory-Chunks.html#GMemChunk"><span class="type">GMemChunk</span></a>.Used in <a class="link" href="glib-Memory-Chunks.html#g-mem-chunk-new"><code class="function">g_mem_chunk_new()</code></a> and <a class="link" href="glib-Memory-Chunks.html#g-mem-chunk-create"><code class="function">g_mem_chunk_create()</code></a> to specify that atomswill never be freed individually.</p></div><hr><div class="refsect2" lang="en"><a name="id3233529"></a><h3><a name="g-mem-chunk-new"></a>g_mem_chunk_new ()</h3><a class="indexterm" name="id3233544"></a><pre class="programlisting"><a class="link" href="glib-Memory-Chunks.html#GMemChunk">GMemChunk</a>*          g_mem_chunk_new                     (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *name,                                                         <a class="link" href="glib-Basic-Types.html#gint">gint</a> atom_size,                                                         <a class="link" href="glib-Basic-Types.html#gsize">gsize</a> area_size,                                                         <a class="link" href="glib-Basic-Types.html#gint">gint</a> type);</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_new</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>Creates a new <a class="link" href="glib-Memory-Chunks.html#GMemChunk"><span class="type">GMemChunk</span></a>.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>name</code></em>&#160;:</span></p></td><td>a string to identify the <a class="link" href="glib-Memory-Chunks.html#GMemChunk"><span class="type">GMemChunk</span></a>. It is not copied so itshould be valid for the lifetime of the <a class="link" href="glib-Memory-Chunks.html#GMemChunk"><span class="type">GMemChunk</span></a>. It is only used in<a class="link" href="glib-Memory-Chunks.html#g-mem-chunk-print"><code class="function">g_mem_chunk_print()</code></a>, which is used for debugging.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>atom_size</code></em>&#160;:</span></p></td><td>the size, in bytes, of each element in the <a class="link" href="glib-Memory-Chunks.html#GMemChunk"><span class="type">GMemChunk</span></a>.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>area_size</code></em>&#160;:</span></p></td><td>the size, in bytes, of each block of memory allocated to containthe atoms.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>type</code></em>&#160;:</span></p></td><td>the type of the <a class="link" href="glib-Memory-Chunks.html#GMemChunk"><span class="type">GMemChunk</span></a>.<a class="link" href="glib-Memory-Chunks.html#G-ALLOC-AND-FREE:CAPS"><span class="type">G_ALLOC_AND_FREE</span></a> is used if the atoms will be freed individually.<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>&#160;:</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="id3233777"></a><h3><a name="g-mem-chunk-alloc"></a>g_mem_chunk_alloc ()</h3><a class="indexterm" name="id3233793"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a>            g_mem_chunk_alloc                   (<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_alloc</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-alloc"><code class="function">g_slice_alloc()</code></a> instead</p></div><p>Allocates an atom of memory from a <a class="link" href="glib-Memory-Chunks.html#GMemChunk"><span class="type">GMemChunk</span></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_chunk</code></em>&#160;:</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>&#160;:</span></p></td><td>a pointer to the allocated atom.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3233889"></a><h3><a name="g-mem-chunk-alloc0"></a>g_mem_chunk_alloc0 ()</h3><a class="indexterm" name="id3233906"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a>            g_mem_chunk_alloc0                  (<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_alloc0</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-alloc0"><code class="function">g_slice_alloc0()</code></a> instead</p></div><p>Allocates an atom of memory from a <a class="link" href="glib-Memory-Chunks.html#GMemChunk"><span class="type">GMemChunk</span></a>, setting the memory to 0.</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>&#160;:</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>&#160;:</span></p></td><td>a pointer to the allocated atom.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3234003"></a><h3><a name="g-mem-chunk-free"></a>g_mem_chunk_free ()</h3><a class="indexterm" name="id3234019"></a><pre class="programlisting">void                g_mem_chunk_free                    (<a class="link" href="glib-Memory-Chunks.html#GMemChunk">GMemChunk</a> *mem_chunk,                                                         <a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> mem);</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_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-free1"><code class="function">g_slice_free1()</code></a> instead</p></div><p>Frees an atom in a <a class="link" href="glib-Memory-Chunks.html#GMemChunk"><span class="type">GMemChunk</span></a>.This should only be called if the <a class="link" href="glib-Memory-Chunks.html#GMemChunk"><span class="type">GMemChunk</span></a> was created with<a class="link" href="glib-Memory-Chunks.html#G-ALLOC-AND-FREE:CAPS"><span class="type">G_ALLOC_AND_FREE</span></a>. Otherwise it will simply return.</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>&#160;:</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"><em class="parameter"><code>mem</code></em>&#160;:</span></p></td><td>a pointer to the atom to free.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3234145"></a><h3><a name="g-mem-chunk-destroy"></a>g_mem_chunk_destroy ()</h3><a class="indexterm" name="id3234160"></a><pre class="programlisting">void                g_mem_chunk_destroy                 (<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_destroy</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 all of the memory allocated for a <a class="link" href="glib-Memory-Chunks.html#GMemChunk"><span class="type">GMemChunk</span></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_chunk</code></em>&#160;:</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="id3234242"></a><h3><a name="g-mem-chunk-create"></a>g_mem_chunk_create()</h3><a class="indexterm" name="id3234258"></a><pre class="programlisting">#define             g_mem_chunk_create(type, pre_alloc, alloc_type)</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_create</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>A convenience macro for creating a new <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-new"><code class="function">g_mem_chunk_new()</code></a>, using the given type to create the <a class="link" href="glib-Memory-Chunks.html#GMemChunk"><span class="type">GMemChunk</span></a>name. The atom size is determined using <code class="function"><code class="function">sizeof()</code></code>, and thearea size is calculated by multiplying the <em class="parameter"><code>pre_alloc</code></em> parameter withthe atom size.</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>&#160;:</span></p></td><td>the type of the atoms, typically a structure name.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>pre_alloc</code></em>&#160;:</span></p></td><td>the number of atoms to store in each block of memory.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>alloc_type</code></em>&#160;:</span></p></td><td>the type of the <a class="link" href="glib-Memory-Chunks.html#GMemChunk"><span class="type">GMemChunk</span></a>.<a class="link" href="glib-Memory-Chunks.html#G-ALLOC-AND-FREE:CAPS"><span class="type">G_ALLOC_AND_FREE</span></a> is used if the atoms will be freed individually.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -