GLib.TrashStack¶
Fields¶
Name |
Type |
Access |
Description |
---|---|---|---|
next |
r/w |
pointer to the previous element of the stack, gets stored in the first |
Methods¶
class |
|
class |
|
class |
|
class |
|
Details¶
- class GLib.TrashStack¶
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 agpointer
. 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
. ANULL
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.Deprecated since version 2.48:
GTrashStack
is deprecated without replacement- classmethod height(stack_p)[source]¶
- Parameters:
stack_p (
GLib.TrashStack
) – aGLib.TrashStack
- Returns:
the height of the stack
- Return type:
Returns the height of a
GLib.TrashStack
.Note that execution of this function is of O(N) complexity where N denotes the number of items on the stack.
Deprecated since version 2.48:
GLib.TrashStack
is deprecated without replacement
- classmethod peek(stack_p)[source]¶
- Parameters:
stack_p (
GLib.TrashStack
) – aGLib.TrashStack
- Returns:
the element at the top of the stack
- Return type:
Returns the element at the top of a
GLib.TrashStack
which may beNone
.Deprecated since version 2.48:
GLib.TrashStack
is deprecated without replacement
- classmethod pop(stack_p)[source]¶
- Parameters:
stack_p (
GLib.TrashStack
) – aGLib.TrashStack
- Returns:
the element at the top of the stack
- Return type:
Pops a piece of memory off a
GLib.TrashStack
.Deprecated since version 2.48:
GLib.TrashStack
is deprecated without replacement
- classmethod push(stack_p, data_p)[source]¶
- Parameters:
stack_p (
GLib.TrashStack
) – aGLib.TrashStack
data_p (
object
) – the piece of memory to push on the stack
Pushes a piece of memory onto a
GLib.TrashStack
.Deprecated since version 2.48:
GLib.TrashStack
is deprecated without replacement