index.html
Main Page
|
modules.html
Modules
|
namespaces.html
Namespace List
|
hierarchy.html
Class Hierarchy
|
annotated.html
Data Structures
|
dirs.html
Directories
|
files.html
File List
|
namespacemembers.html
Namespace Members
|
functions.html
Data Fields
|
pages.html
Related Pages
memory pools
[
group__DBusInternals.html
D-BUS internal implementation details
]
structDBusMemPool.html
DBusMemPool
object.
#_details
More...
Typedefs
typedef
structDBusMemPool.html
DBusMemPool
group__DBusMemPool.html#ga4
DBusMemPool
Opaque object representing a memory pool.
#ga4
Functions
structDBusMemPool.html
DBusMemPool
*
group__DBusMemPool.html#ga0
_dbus_mem_pool_new
(int element_size,
group__DBusTypes.html#ga2
dbus_bool_t
zero_elements)
Creates a new memory pool, or returns
group__DBusMacros.html#ga4
NULL
on failure.
#ga0
void
group__DBusMemPool.html#ga1
_dbus_mem_pool_free
(
structDBusMemPool.html
DBusMemPool
*pool)
Frees a memory pool (and all elements allocated from it).
#ga1
void *
group__DBusMemPool.html#ga2
_dbus_mem_pool_alloc
(
structDBusMemPool.html
DBusMemPool
*pool)
Allocates an object from the memory pool.
#ga2
group__DBusTypes.html#ga2
dbus_bool_t
group__DBusMemPool.html#ga3
_dbus_mem_pool_dealloc
(
structDBusMemPool.html
DBusMemPool
*pool, void *element)
Deallocates an object previously created with
group__DBusMemPool.html#ga2
_dbus_mem_pool_alloc()
.
#ga3
Detailed Description
structDBusMemPool.html
DBusMemPool
object.
Types and functions related to
structDBusMemPool.html
DBusMemPool
. A memory pool is used to decrease memory fragmentation/overhead and increase speed for blocks of small uniformly-sized objects. The main point is to avoid the overhead of a malloc block for each small object, speed is secondary.
Typedef Documentation
structDBusMemPool.html
DBusMemPool
Opaque object representing a memory pool.
Memory pools allow avoiding per-malloc-block memory overhead when allocating a lot of small objects that are all the same size. They are slightly faster than calling malloc() also.
Definition at line
dbus-mempool_8h-source.html#l00033
33
of file
dbus-mempool_8h-source.html
dbus-mempool.h
.
Function Documentation
void* _dbus_mem_pool_alloc
(
structDBusMemPool.html
DBusMemPool
*
pool
)
Allocates an object from the memory pool.
The object must be freed with
group__DBusMemPool.html#ga3
_dbus_mem_pool_dealloc()
.
Parameters:
pool
the memory pool
Returns:
the allocated object or
group__DBusMacros.html#ga4
NULL
if no memory.
Definition at line
dbus-mempool_8c-source.html#l00208
208
of file
dbus-mempool_8c-source.html
dbus-mempool.c
.
References
dbus-internals_8h-source.html#l00100
_dbus_assert
,
dbus-internals_8h-source.html#l00194
_DBUS_INT_MAX
,
dbus-mempool_8c-source.html#l00104
allocated_elements
,
dbus-mempool_8c-source.html#l00099
block_size
,
dbus-mempool_8c-source.html#l00103
blocks
,
dbus-memory_8c-source.html#l00437
dbus_malloc()
,
dbus-memory_8c-source.html#l00488
dbus_malloc0()
,
dbus-mempool_8c-source.html#l00068
ELEMENT_PADDING
,
dbus-mempool_8c-source.html#l00098
element_size
,
dbus-mempool_8c-source.html#l00090
DBusMemBlock::elements
,
dbus-mempool_8c-source.html#l00102
free_elements
,
dbus-mempool_8c-source.html#l00082
DBusMemBlock::next
,
dbus-mempool_8c-source.html#l00061
DBusFreedElement::next
,
group__DBusMacros.html#ga4
NULL
,
dbus-mempool_8c-source.html#l00088
DBusMemBlock::used_so_far
, and
dbus-mempool_8c-source.html#l00100
zero_elements
.
group__DBusTypes.html#ga2
dbus_bool_t
_dbus_mem_pool_dealloc
(
structDBusMemPool.html
DBusMemPool
*
pool
,
void *
element
)
Deallocates an object previously created with
group__DBusMemPool.html#ga2
_dbus_mem_pool_alloc()
.
The previous object must have come from this same pool.
Parameters:
pool
the memory pool
element
the element earlier allocated.
Returns:
group__DBusMacros.html#ga2
TRUE
if there are no remaining allocated elements
Definition at line
dbus-mempool_8c-source.html#l00336
336
of file
dbus-mempool_8c-source.html
dbus-mempool.c
.
References
dbus-internals_8h-source.html#l00100
_dbus_assert
,
dbus-internals_8h-source.html#l00112
_dbus_assert_not_reached
,
dbus-mempool_8c-source.html#l00104
allocated_elements
,
dbus-mempool_8c-source.html#l00103
blocks
,
dbus-memory_8c-source.html#l00612
dbus_free()
,
dbus-mempool_8c-source.html#l00090
DBusMemBlock::elements
,
group__DBusMacros.html#ga3
FALSE
,
dbus-mempool_8c-source.html#l00102
free_elements
,
dbus-mempool_8c-source.html#l00082
DBusMemBlock::next
,
dbus-mempool_8c-source.html#l00061
DBusFreedElement::next
, and
group__DBusMacros.html#ga4
NULL
.
Referenced by
dbus-hash_8c-source.html#l01627
_dbus_hash_table_free_preallocated_entry()
.
void _dbus_mem_pool_free
(
structDBusMemPool.html
DBusMemPool
*
pool
)
Frees a memory pool (and all elements allocated from it).
Parameters:
pool
the memory pool.
Definition at line
dbus-mempool_8c-source.html#l00183
183
of file
dbus-mempool_8c-source.html
dbus-mempool.c
.
References
dbus-mempool_8c-source.html#l00103
blocks
,
dbus-memory_8c-source.html#l00612
dbus_free()
,
dbus-mempool_8c-source.html#l00082
DBusMemBlock::next
, and
group__DBusMacros.html#ga4
NULL
.
Referenced by
dbus-hash_8c-source.html#l00374
_dbus_hash_table_unref()
.
structDBusMemPool.html
DBusMemPool
* _dbus_mem_pool_new
(
int
element_size
,
group__DBusTypes.html#ga2
dbus_bool_t
zero_elements
)
Creates a new memory pool, or returns
group__DBusMacros.html#ga4
NULL
on failure.
Objects in the pool must be at least sizeof(void*) bytes each, due to the way memory pools work. To avoid creating 64 bit problems, this means at least 8 bytes on all platforms, unless you are 4 bytes on 32-bit and 8 bytes on 64-bit.
Parameters:
element_size
size of an element allocated from the pool.
zero_elements
whether to zero-initialize elements
Returns:
the new pool or
group__DBusMacros.html#ga4
NULL
Definition at line
dbus-mempool_8c-source.html#l00136
136
of file
dbus-mempool_8c-source.html
dbus-mempool.c
.
References
dbus-internals_8h-source.html#l00100
_dbus_assert
,
dbus-mempool_8c-source.html#l00104
allocated_elements
,
dbus-mempool_8c-source.html#l00099
block_size
,
dbus-memory_8h-source.html#l00042
dbus_new0
,
dbus-mempool_8c-source.html#l00098
element_size
,
group__DBusMacros.html#ga3
FALSE
,
group__DBusMacros.html#ga4
NULL
, and
dbus-mempool_8c-source.html#l00100
zero_elements
.
Referenced by
dbus-hash_8c-source.html#l00292
_dbus_hash_table_new()
.
Generated on Tue Sep 13 01:28:09 2005 for D-BUS by
http://www.doxygen.org/index.html
doxygen
1.4.4
