Charles.Forsyth20060303-partialeea662d19 years agoHistory
70 lines · 1.8 KB · Text
RawDownload
.TH XALLOC 10.2.SH NAMExalloc, xspanalloc, xfree \- basic memory management.SH SYNOPSIS.ta \w'\fLvoid* 'u.Bvoid*	xalloc(ulong size).PP.Bvoid*	xspanalloc(ulong size, int align, ulong span).PP.Bvoid	xfree(void *p).SH DESCRIPTION.I Xallocand.I xfreeare primitives used by higher-level memory allocators in the kernel,such as.IR malloc (10.2).They are not intended for use directly by most kernel routines.The main exceptions are routines that permanently allocate large structures,or need the special alignment properties guaranteed by.IR xspanalloc ..PP.I Xallocreturns a pointer to a range of size bytes of memory. The memory will be zero filled and aligned on a 8 byte.RB ( BY2V )address. If the memory is not available,.B xallocreturns a null pointer..PP.I Xspanallocallocates memory given alignment and spanning constraints.The block returned will contain.I sizebytes, aligned on a boundary that is.BI "0 mod" " align,"in such a way that the memory in the block does notspan an address that is.BI "0 mod" " span.".I Xspanallocis intended for useallocating hardware data structures (eg, page tables) or I/O buffersthat must satisfy specific alignment restrictions.If.I xspanalloccannot allocate memory to satisfy the given constraints, it will.IR panic (10.2).The technique it uses can sometimes cause memory to be wasted.Consequently,.I xspanallocshould be used sparingly..PP.I Xfreefrees the block of memory at.IR p ,which must be an address previously returned by.I xalloc(not.IR xspanalloc )..SS Allocation statusSome memory allocation statistics are written to the console in response tothe debugging sequence.LR "control-T control-T x" .The output includes the total free space, the number of free holes,and a summary of active holes.Each line shows `address top size'..SH SEE ALSO.IR malloc (10.2)