|
|
1.1 root 1: .TH ALLOC 9.3
2: .CT 2 mem_man
3: .SH NAME
4: alloc, free, balloc, bfree, gcalloc, gcfree \- allocate memory
5: .SH SYNOPSIS
6: .B #include <jerq.h>
7: .PP
8: .B char *alloc(nbytes)
9: .B unsigned nbytes;
10: .PP
11: .B void free(s)
12: .B char *s;
13: .PP
14: .B Bitmap *balloc(r)
15: .B Rectangle r;
16: .PP
17: .B void bfree(b)
18: .B Bitmap *b;
19: .PP
20: .B char *gcalloc(nbytes, where)
21: .B unsigned long nbytes;
22: .B char **where;
23: .PP
24: .B void gcfree(s)
25: .B char *s;
26: .SH DESCRIPTION
27: .I Alloc
28: corresponds to the standard C function
29: .IR calloc ;
30: see
31: .IR malloc (3).
32: It returns a pointer to a block of
33: .I nbytes
34: contiguous bytes of storage, or 0
35: if unavailable.
36: The storage is aligned on 4-byte boundaries
37: and is cleared to zeros.
38: .I Free
39: frees storage allocated by
40: .IR alloc .
41: .PP
42: .I Balloc
43: returns a pointer to a Bitmap
44: large enough to contain
45: the Rectangle
46: .IR r ,
47: or 0
48: for failure.
49: The coordinate system inside the Bitmap is set by
50: .IR r :
51: the
52: .B origin
53: and
54: .B corner
55: of the Bitmap are those of
56: .IR r .
57: .I Bfree
58: frees the storage associated with a Bitmap allocated by
59: .IR balloc .
60: .PP
61: .I Gcalloc
62: provides a simple garbage-compacting allocator.
63: It returns a pointer to a block of
64: .I nbytes
65: contiguous bytes of storage, or
66: 0
67: if unavailable.
68: The storage is initialized to zeros.
69: .I Where
70: is a pointer to the user's data where the location of the
71: block is to be saved.
72: The return value of
73: .I gcalloc
74: is stored in
75: .BI * where
76: and will be updated after each compaction.
77: Therefore, a program using
78: .I gcalloc
79: should never store the location of memory obtained from
80: .I gcalloc
81: anywhere other than
82: .I where.
83: Typically, this location is contained in a structure, such as a
84: Bitmap
85: .RI ( balloc
86: uses
87: .IR gcalloc ).
88: .I Gcfree
89: frees the storage block at
90: .IR p .
91: .SH SEE ALSO
92: .IR types (9.5),
93: .IR malloc (3)
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.