tcp_malloc(3)

NAME
tcp_calloc, tcp_malloc, tcp_free - Allocate and free memory

SYNOPSIS
#include <net/misc.h>

void *tcp_calloc(size_t nmemb, size_t size);
void *tcp_malloc(size_t size);
void tcp_free(void *ptr);

DESCRIPTION
calloc() allocates memory for an array of nmemb elements of size bytes each and returns a pointer to the allocated memory. The memory is set to zero.

malloc() allocates size bytes and returns a pointer to the allocated memory. The memory is not cleared.

free() frees the memory space pointed to by ptr, which must have been returned by a previous call to malloc() or calloc() Otherwise, or if free(ptr) has already been called before, undefined behaviour occurs. If ptr is NULL, no operation is performed.

RETURN VALUES
For calloc() and malloc(), the value returned is a pointer to the allocated memory, which is suitably aligned for any kind of variable, or NULL if the request fails.

free() returns no value.

SEE ALSO
tcp_pagein(3z) ,tcp_pageout(3z)

NOTES
These functions manipulate memory in a private memory page belonging to ZSock. This 16k page holds all the buffers that ZSock uses and hence requests for large amounts of memory are likely to fail (and in any case are not recommended).

This facility has been offered to allow daemons to be written simply (they have no address space of their own). User applications should not use these facilities. If a large (>256 bytes) amount of memory is required for a user application then the application should either be of the BAD type or be redesigned.

AUTHOR
Dominic Morris <dom@jb.man.ac.uk>