#include <glib.h>
Go to the source code of this file.
Defines | |
#define | WFREE_NULL(p, size) |
Functions | |
gpointer | walloc (size_t size) |
Allocate memory from a zone suitable for the given size. | |
gpointer | walloc0 (size_t size) |
Same as walloc(), but zeroes the allocated memory before returning. | |
void | wfree (gpointer ptr, size_t size) |
Free a block allocated via walloc(). | |
gpointer | wrealloc (gpointer old, size_t old_size, size_t new_size) |
Reallocate a block allocated via walloc(). | |
WARN_UNUSED_RESULT gpointer | wcopy (gconstpointer ptr, size_t size) |
void | wdestroy (void) |
Destroy all the zones we allocated so far. |
|
Value: G_STMT_START { \ if (p) { \ wfree(p,size); \ p = NULL; \ } \ } G_STMT_END |
|
Allocate memory from a zone suitable for the given size. The basics for this algorithm is to allocate from fixed-sized zones, which are multiples of ZALLOC_ALIGNBYTES until WALLOC_MAX (e.g. 8, 16, 24, 40, ...) and to malloc() if size is greater or equal to WALLOC_MAX. Naturally, zones are allocated on demand only.
|
|
Same as walloc(), but zeroes the allocated memory before returning.
|
|
|
|
Destroy all the zones we allocated so far.
|
|
Free a block allocated via walloc(). The size is used to find the zone from which the block was allocated, or to determine that we actually malloc()'ed it so it gets free()'ed. |
|
Reallocate a block allocated via walloc().
|