glib/docs/reference/glib/tmpl/trash_stack.sgml
Owen Taylor 2ae1a46b4c Add g_object_add/remove_toggle_ref() functions to get notification when a
2005-05-05  Owen Taylor  <otaylor@redhat.com>

        * gobject.[ch] gobject.symbols: Add
        g_object_add/remove_toggle_ref() functions to get notification
        when a reference count is the last remaining reference; this
        enables better memory management for language bindings.
        (http://mail.gnome.org/archives/gtk-devel-list/2005-April/msg00095.html)

2005-05-05  Owen Taylor  <otaylor@redhat.com>

        * glib/gdataset.[ch] glib/gdatasetprivate.h: Add
        g_datalist_set/unset_flags(), g_datalist_get_flags() functions
        to squeeze some bits into a GDataSet... this is needed for
        efficient implementation of toggle references in GObject.

        * tests/gobject/references.c tests/gobject/Makefile.am:
        Add a test case for weak and toggle references.

        * glib/gfileutils.[ch]: Rename g_file_replace() back
        to g_file_set_contents().

        * glib/glib.symbols: Update.

2005-05-05  Owen Taylor  <otaylor@redhat.com>

        * glib/Makefile.am glib/glib-sections.txt gobject/gobject-sections.txt:
        Update

        * gobject/tmpl/objects.sgml: Document toggle-references.
2005-05-05 14:57:29 +00:00

73 lines
1.8 KiB
Plaintext

<!-- ##### SECTION Title ##### -->
Trash Stacks
<!-- ##### SECTION Short_Description ##### -->
maintain a stack of unused allocated memory chunks.
<!-- ##### SECTION Long_Description ##### -->
<para>
A #GTrashStack is an efficient way to keep a stack of unused allocated
memory chunks. Each memory chunk is required to be large enough to hold
a #gpointer. This allows the stack to be maintained without any space
overhead, since the stack pointers can be stored inside the memory chunks.
</para>
<para>
There is no function to create a #GTrashStack. A %NULL #GTrashStack*
is a perfectly valid empty stack.
</para>
<!-- ##### SECTION See_Also ##### -->
<para>
</para>
<!-- ##### SECTION Stability_Level ##### -->
<!-- ##### STRUCT GTrashStack ##### -->
<para>
Each piece of memory that is pushed onto the stack
is cast to a <structname>GTrashStack*</structname>.
</para>
@next: pointer to the previous element of the stack,
gets stored in the first <literal>sizeof (gpointer)</literal>
bytes of the element.
<!-- ##### FUNCTION g_trash_stack_push ##### -->
<para>
Pushes a piece of memory onto a #GTrashStack.
</para>
@stack_p: a pointer to a #GTrashStack.
@data_p: the piece of memory to push on the stack.
<!-- ##### FUNCTION g_trash_stack_pop ##### -->
<para>
Pops a piece of memory off a #GTrashStack.
</para>
@stack_p: a pointer to a #GTrashStack.
@Returns: the element at the top of the stack.
<!-- ##### FUNCTION g_trash_stack_peek ##### -->
<para>
Returns the element at the top of a #GTrashStack.
</para>
@stack_p: a pointer to a #GTrashStack.
@Returns: the element at the top of the stack.
<!-- ##### FUNCTION g_trash_stack_height ##### -->
<para>
Returns the height of a #GTrashStack.
</para>
@stack_p: a pointer to a #GTrashStack.
@Returns: the height of the stack.