~ubuntu-branches/ubuntu/karmic/glib2.0/karmic-updates

« back to all changes in this revision

Viewing changes to docs/reference/glib/html/glib-Memory-Slices.html

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2009-07-07 08:55:47 UTC
  • mfrom: (1.2.49 upstream)
  • Revision ID: james.westby@ubuntu.com-20090707085547-oma0yur1uaq4zmop
Tags: 2.21.3-0ubuntu1
* New upstream version:
  - GMappedFile is refcounted now
  - Mainloop: It is now possible to set per-thread default contexts,
    with g_main_context_push_thread_default.
  - glib-mkenums supports a @basename@ substitution, in addition
    to @filename@.
  - GIO:
    + Vfs implementations can support storing of per-file metadata.
    + GCancellable can now be subclassed.
    + Unmount and eject methods now optionally allow interaction, via
      variants that take a GMountOperation object.
  - Bugs fixed:
   556706 Inconsistent help arguments -h, -?
   579449 FileChoosers no longer work if an idle handler is active
   579933 mainloop FD_CLOEXEC has a race condition
   579984 alternate GMainContext support
   585937 gio/gsocket.c (glib 2.21.2) does not compile (Windows/mingw)
   586675 Runtime library location
   586797 Add GCancellables to GSocket ops
   586868 g_filename_complete_get_completions doesn't always return...
   587415 g_resolver_lookup_by_name_finish returns a freed list
   587434 regression tests fail, at least on x86_64
   586928 Avoid g++ warning in g_error()
  - Updated translations: Estonian, Hebrew
* Drop 00git_file_attr_stringv.patch, in upstream release now.

Show diffs side-by-side

added added

removed removed

Lines of Context:
88
88
<p>
89
89
To achieve these goals, the slice allocator uses a sophisticated,
90
90
layered design that has been inspired by Bonwick's slab allocator
91
 
<sup>[<a name="id828202" href="#ftn.id828202" class="footnote">6</a>]</sup>.
 
91
<sup>[<a name="id777585" href="#ftn.id777585" class="footnote">6</a>]</sup>.
92
92
It uses <code class="function">posix_memalign()</code> to optimize allocations of many equally-sized
93
93
chunks, and has per-thread free lists (the so-called magazine layer)
94
94
to quickly satisfy allocation requests of already known structure sizes.
109
109
object size used at allocation time is still available when freeing.
110
110
</p>
111
111
<div class="example">
112
 
<a name="id828306"></a><p class="title"><b>Example 15. Using the slice allocator</b></p>
 
112
<a name="id777689"></a><p class="title"><b>Example 15. Using the slice allocator</b></p>
113
113
<div class="example-contents"><pre class="programlisting">
114
114
  gchar *mem[10000];
115
115
  gint i;
129
129
</pre></div>
130
130
</div>
131
131
<br class="example-break"><div class="example">
132
 
<a name="id828322"></a><p class="title"><b>Example 16. Using the slice allocator with data structures</b></p>
 
132
<a name="id777705"></a><p class="title"><b>Example 16. Using the slice allocator with data structures</b></p>
133
133
<div class="example-contents"><pre class="programlisting">
134
134
  GRealArray *array;
135
135
  /* Allocate one block, using the g_slice_new() macro. */
470
470
</div>
471
471
<div class="footnotes">
472
472
<br><hr width="100" align="left">
473
 
<div class="footnote"><p><sup>[<a name="ftn.id828202" href="#id828202" class="para">6</a>] </sup>
 
473
<div class="footnote"><p><sup>[<a name="ftn.id777585" href="#id777585" class="para">6</a>] </sup>
474
474
<a class="ulink" href="http://citeseer.ist.psu.edu/bonwick94slab.html" target="_top">[Bonwick94]</a> Jeff Bonwick, The slab allocator: An object-caching kernel
475
475
memory allocator. USENIX 1994, and
476
476
<a class="ulink" href="http://citeseer.ist.psu.edu/bonwick01magazines.html" target="_top">[Bonwick01]</a> Bonwick and Jonathan Adams, Magazines and vmem: Extending the