Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ (2) — Plan9 4th Edition

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

venti(2)

VENTI-MEM(2)

NAME

vtbrk, vtmalloc, vtmallocz, vtrealloc, vtstrdup, vtfree − error-checking memory allocators

SYNOPSIS

#include <u.h>
#include <libc.h>
#include <venti.h>

void∗vtbrk(int size)

void∗vtmalloc(int size)

void∗vtmallocz(int size)

void∗vtrealloc(void ∗ptr, int size)

char∗vtstrdup(char ∗s)

voidvtfree(void ∗ptr)

DESCRIPTION

These routines allocate and free memory.  On failure, they print an error message and call sysfatal (from perror(2)). They do not return.

­Vtbrk returns a pointer to a new, permanently allocated block of at least ­size bytes. 

Vtmalloc, vtrealloc, and ­vtstrdup are like malloc, realloc, and strdup, but, as noted above, do not return on error. ­Vtmallocz is like ­vtmalloc but zeros the block before returning it.  Memory allocated with all four should be freed with ­vtfree when no longer needed. 

SOURCE

­/sys/src/libventi

SEE ALSO

venti(2)

Plan 9  —  March 14, 2011

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026