3 xalloc, xallocz, xspanalloc, xfree, xsummary \- basic memory management
7 void* xalloc(ulong size)
10 void* xallocz(ulong size, int clr)
13 void* xspanalloc(ulong size, int align, ulong span)
21 These are primitives used by higher-level memory allocators in the kernel,
24 They are not intended for use directly by most kernel routines.
25 The main exceptions are routines that permanently allocate large structures,
26 or need the special alignment properties guaranteed by
30 returns a pointer to a range of size bytes of memory. The memory will be zero filled and aligned on a 8 byte
32 address. If the memory is not available,
34 returns a null pointer.
37 will clear the memory after allocation if
39 is set to a value other than zero. Since it is used by
41 the same diagnostics apply.
44 allocates memory given alignment and spanning constraints.
45 The block returned will contain
47 bytes, aligned on a boundary that is
49 in such a way that the memory in the block does not
50 span an address that is
54 allocating hardware data structures (eg, page tables) or I/O buffers
55 that must satisfy specific alignment restrictions.
58 cannot allocate memory to satisfy the given constraints, it will
60 The technique it uses can sometimes cause memory to be wasted.
63 should be used sparingly.
66 frees the block of memory at
68 which must be an address previously returned by
74 dumps memory allocation statistics to the console.
75 The output includes the total free space, the number of free holes,
76 and a summary of active holes.
77 Each line shows `address top size'.
79 .B /sys/src/9/port/xalloc.c