From 78e51a8c6678b6e3dff3d619aa786669f531f4bc Mon Sep 17 00:00:00 2001 From: rsc Date: Fri, 14 Jan 2005 03:45:44 +0000 Subject: checkpoint --- man/man3/bin.html | 131 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 131 insertions(+) create mode 100644 man/man3/bin.html (limited to 'man/man3/bin.html') diff --git a/man/man3/bin.html b/man/man3/bin.html new file mode 100644 index 00000000..f016622f --- /dev/null +++ b/man/man3/bin.html @@ -0,0 +1,131 @@ + +bin(3) - Plan 9 from User Space + + + + +
+
+
BIN(3)BIN(3) +
+
+

NAME
+ +
+ + binalloc, bingrow, binfree – grouped memory allocation
+ +
+

SYNOPSIS
+ +
+ + #include <u.h>
+ #include <libc.h>
+ #include <bin.h> +
+
+ +
+ + typedef struct BinBin; +
+
+ void    *binalloc(Bin **bp, ulong size, int clr); +
+
+ void    *bingrow(Bin **bp, void *op, ulong osize,
+ +
+ + +
+ + ulong size, int clr); +
+ +
+ +
+
+
+ + +
+ + + +
+ +
+ void    binfree(Bin **bp);
+
+
+

DESCRIPTION
+ +
+ + These routines provide simple grouped memory allocation and deallocation. + Items allocated with binalloc are added to the Bin pointed to + by bp. All items in a bin may be freed with one call to binfree; + there is no way to free a single item. +
+ + Binalloc returns a pointer to a new block of at least size bytes. + The block is suitably aligned for storage of any type of object. + No two active pointers from binalloc will have the same value. + The call binalloc(0) returns a valid pointer rather than null. + If clr is non-zero, the allocated memory is set to 0; otherwise, + the contents are undefined. +
+ + Bingrow is used to extend the size of a block of memory returned + by binalloc. Bp must point to the same bin group used to allocate + the original block, and osize must be the last size used to allocate + or grow the block. A pointer to a block of at least size bytes + is returned, with the same contents in the first osize + locations. If clr is non-zero, the remaining bytes are set to + 0, and are undefined otherwise. If op is nil, it and osize are + ignored, and the result is the same as calling binalloc. +
+ + Binalloc and bingrow allocate large chunks of memory using malloc(3) + and return pieces of these chunks. The chunks are free’d upon + a call to binfree.
+ +
+

SOURCE
+ +
+ + /usr/local/plan9/src/libbin
+
+
+

SEE ALSO
+ +
+ + malloc(3)
+ +
+

DIAGNOSTICS
+ +
+ + binalloc and bingrow return 0 if there is no available memory.
+ +
+ +

+
+
+ + +
+
+
+Space Glenda +
+
+ + -- cgit v1.2.3