:right-sidebar: True TrashStack =================================================================== .. currentmodule:: gi.repository.GLib .. deprecated:: 2.48 ``GTrashStack`` is deprecated without replacement .. class:: TrashStack(*args, **kwargs) :no-contents-entry: 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. There is no function to create a ``GTrashStack``. A ``NULL`` ``GTrashStack*`` is a perfectly valid empty stack. Each piece of memory that is pushed onto the stack is cast to a ``GTrashStack*``. There is no longer any good reason to use ``GTrashStack``. If you have extra pieces of memory, ``free()`` them and allocate them again later. Methods ------- .. rst-class:: interim-class .. class:: TrashStack :no-index: .. method:: height(stack_p: ~gi.repository.GLib.TrashStack) -> int Returns the height of a :obj:`~gi.repository.GLib.TrashStack`. Note that execution of this function is of O(N) complexity where N denotes the number of items on the stack. .. deprecated:: 2.48 :obj:`~gi.repository.GLib.TrashStack` is deprecated without replacement :param stack_p: a :obj:`~gi.repository.GLib.TrashStack` .. method:: peek(stack_p: ~gi.repository.GLib.TrashStack) -> None Returns the element at the top of a :obj:`~gi.repository.GLib.TrashStack` which may be :const:`None`. .. deprecated:: 2.48 :obj:`~gi.repository.GLib.TrashStack` is deprecated without replacement :param stack_p: a :obj:`~gi.repository.GLib.TrashStack` .. method:: pop(stack_p: ~gi.repository.GLib.TrashStack) -> None Pops a piece of memory off a :obj:`~gi.repository.GLib.TrashStack`. .. deprecated:: 2.48 :obj:`~gi.repository.GLib.TrashStack` is deprecated without replacement :param stack_p: a :obj:`~gi.repository.GLib.TrashStack` .. method:: push(stack_p: ~gi.repository.GLib.TrashStack, data_p: None) -> None Pushes a piece of memory onto a :obj:`~gi.repository.GLib.TrashStack`. .. deprecated:: 2.48 :obj:`~gi.repository.GLib.TrashStack` is deprecated without replacement :param stack_p: a :obj:`~gi.repository.GLib.TrashStack` :param data_p: the piece of memory to push on the stack Fields ------ .. rst-class:: interim-class .. class:: TrashStack :no-index: .. attribute:: next Pointer to the previous element of the stack, gets stored in the first `sizeof (gpointer)` bytes of the element