#include "gm_call_trace.h"#include "gm_internal.h"#include "gm_malloc_debug.h"Functions | |
| GM_ENTRY_POINT struct gm_zone * | gm_zone_create_zone (void *base, gm_size_t length) |
| GM_ENTRY_POINT void | gm_zone_destroy_zone (struct gm_zone *zone) |
| GM_ENTRY_POINT void * | gm_zone_free (struct gm_zone *zone, void *a) |
| GM_ENTRY_POINT void * | gm_zone_malloc (struct gm_zone *zone, gm_size_t length) |
| GM_ENTRY_POINT void * | gm_zone_calloc (struct gm_zone *zone, gm_size_t count, gm_size_t length) |
| GM_ENTRY_POINT int | gm_zone_addr_in_zone (struct gm_zone *zone, void *p) |
This file provides alloc, calloc, and free routines to manage an externally specified "zone" of memory.
This package use buddy-system memory allocation to allocate (2^n)-byte regions of memory, where "n" is referred to as the "size" of the allocated area of memory.
All allocated (or freed) areas are maximally aligned. A zone is a chunk of memory starting and ending on page boundaries. The size and state of each area are encoded in a pair of bit-arrays. One array has a bit set for each position corresponding to a buddy- boundary. The second array has a bit set for each position corresponding to an area that is not free.
In the code, variables named with "size" are in logarithmic units and those named "length" are in real units.
DEBUGGING
If debugging is turned on, we "mark" all valid areas in the zone, using the gm_mark API, and we check each area passed to a function. This should catch any DMA overruns type corruption of the data structures stored in the managed memory.
|
||||||||||||
|
|
|
|
|
|
||||||||||||
|
|
|
||||||||||||
|
gm_zone_malloc() mallocs a GM zone.
|
|
||||||||||||||||
|
gm_zone_calloc() callocs a GM zone.
|
|
||||||||||||
|
|
1.4.4