Data Structures | |
struct | ShutdownClosure |
This struct represents a function to be called on shutdown. More... | |
Defines | |
#define | GUARD_VALUE 0xdeadbeef |
value stored in guard padding for debugging buffer overrun. | |
#define | GUARD_INFO_SIZE 8 |
size of the information about the block stored in guard mode. | |
#define | GUARD_START_PAD 16 |
size of the GUARD_VALUE-filled padding after the header info. | |
#define | GUARD_END_PAD 16 |
size of the GUARD_VALUE-filled padding at the end of the block. | |
#define | GUARD_START_OFFSET (GUARD_START_PAD + GUARD_INFO_SIZE) |
size of stuff at start of block. | |
#define | GUARD_EXTRA_SIZE (GUARD_START_OFFSET + GUARD_END_PAD) |
total extra size over the requested allocation for guard stuff. | |
Typedefs | |
typedef ShutdownClosure | ShutdownClosure |
Represents a function to be called on shutdown. | |
Enumerations | |
enum | BlockSource { SOURCE_UNKNOWN, SOURCE_MALLOC, SOURCE_REALLOC, SOURCE_MALLOC_ZERO, SOURCE_REALLOC_NULL } |
Where the block came from. | |
Functions | |
dbus_bool_t | _dbus_disable_mem_pools (void) |
Whether to turn off mem pools, useful for leak checking. More... | |
void | _dbus_set_fail_alloc_counter (int until_next_fail) |
Sets the number of allocations until we simulate a failed allocation. More... | |
int | _dbus_get_fail_alloc_counter (void) |
Gets the number of successful allocs until we'll simulate a failed alloc. More... | |
void | _dbus_set_fail_alloc_failures (int failures_per_failure) |
Sets how many mallocs to fail when the fail alloc counter reaches 0. More... | |
int | _dbus_get_fail_alloc_failures (void) |
Gets the number of failures we'll have when the fail malloc counter reaches 0. More... | |
dbus_bool_t | _dbus_decrement_fail_alloc_counter (void) |
Called when about to alloc some memory; if it returns TRUE, then the allocation should fail. More... | |
int | _dbus_get_malloc_blocks_outstanding (void) |
Get the number of outstanding malloc()'d blocks. More... | |
dbus_bool_t | _dbus_register_shutdown_func (DBusShutdownFunction function, void *data) |
Register a cleanup function to be called exactly once the next time dbus_shutdown() is called. More... | |
dbus_bool_t | _dbus_memory_test (void) |
Variables | |
int | _dbus_current_generation = 1 |
_dbus_current_generation is used to track each time that dbus_shutdown() is called, so we can reinit things after it's been called. More... |
Implementation details related to allocating and releasing blocks of memory.
|
Called when about to alloc some memory; if it returns TRUE, then the allocation should fail. If it returns FALSE, then the allocation should not fail.
Definition at line 243 of file dbus-memory.c. |
|
Whether to turn off mem pools, useful for leak checking.
Definition at line 170 of file dbus-memory.c. |
|
Gets the number of successful allocs until we'll simulate a failed alloc.
Definition at line 203 of file dbus-memory.c. |
|
Gets the number of failures we'll have when the fail malloc counter reaches 0.
Definition at line 229 of file dbus-memory.c. |
|
Get the number of outstanding malloc()'d blocks.
Definition at line 282 of file dbus-memory.c. |
|
Unit test for DBusMemory
Definition at line 777 of file dbus-memory.c. |
|
Register a cleanup function to be called exactly once the next time dbus_shutdown() is called.
Definition at line 704 of file dbus-memory.c. References ShutdownClosure::data, ShutdownClosure::func, and ShutdownClosure::next. |
|
Sets the number of allocations until we simulate a failed allocation. If set to 0, the next allocation to run fails; if set to 1, one succeeds then the next fails; etc. Set to _DBUS_INT_MAX to not fail anything.
Definition at line 185 of file dbus-memory.c. |
|
Sets how many mallocs to fail when the fail alloc counter reaches 0.
Definition at line 217 of file dbus-memory.c. |
|
_dbus_current_generation is used to track each time that dbus_shutdown() is called, so we can reinit things after it's been called. It is simply incremented each time we shut down. Definition at line 675 of file dbus-memory.c. |