Blob


1 .TH VENTI-MEM 3
2 .SH NAME
3 vtbrk,
4 vtmalloc,
5 vtmallocz,
6 vtrealloc,
7 vtstrdup,
8 vtfree \- error-checking memory allocators
9 .SH SYNOPSIS
10 .ft L
11 #include <u.h>
12 .br
13 #include <libc.h>
14 .br
15 #include <venti.h>
16 .ta +\w'\fLvoid* 'u
17 .PP
18 .B
19 void* vtbrk(int size)
20 .PP
21 .B
22 void* vtmalloc(int size)
23 .PP
24 .B
25 void* vtmallocz(int size)
26 .PP
27 .B
28 void* vtrealloc(void *ptr, int size)
29 .PP
30 .B
31 char* vtstrdup(char *s)
32 .PP
33 .B
34 void vtfree(void *ptr)
35 .SH DESCRIPTION
36 These routines allocate and free memory.
37 On failure, they print an error message and call
38 .IR sysfatal (3).
39 They do not return.
40 .PP
41 .I Vtbrk
42 returns a pointer to a new block of at least
43 .I size
44 bytes.
45 The block cannot be freed.
46 .PP
47 .IR Vtmalloc ,
48 .IR vtrealloc ,
49 and
50 .I vtstrdup
51 are like
52 .IR malloc ,
53 .IR realloc ,
54 and
55 .IR strdup ,
56 but, as noted above, do not return on error.
57 .I Vtmallocz
58 is like
59 .I vtmalloc
60 but zeros the block before returning it.
61 Memory allocated with all four should be freed with
62 .I vtfree
63 when no longer needed.
64 .SH SOURCE
65 .B \*9/src/libventi
66 .SH SEE ALSO
67 .IR venti (3)