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