1tcp_malloc(3) z88dk Programmer's Manual tcp_malloc(3)
2
3
4
6 tcp_calloc, tcp_malloc, tcp_free - Allocate and free memory
7
9 #include <net/misc.h>
10
11 void *tcp_calloc(size_t nmemb, size_t size);
12 void *tcp_malloc(size_t size);
13 void tcp_free(void *ptr);
14
16 calloc() allocates memory for an array of nmemb elements of size bytes
17 each and returns a pointer to the allocated memory. The memory is set
18 to zero.
19
20 malloc() allocates size bytes and returns a pointer to the allocated
21 memory. The memory is not cleared.
22
23 free() frees the memory space pointed to by ptr, which must have been
24 returned by a previous call to malloc() or calloc() Otherwise, or if
25 free(ptr) has already been called before, undefined behaviour occurs.
26 If ptr is NULL, no operation is performed.
27
29 For calloc() and malloc(), the value returned is a pointer to the allo‐
30 cated memory, which is suitably aligned for any kind of variable, or
31 NULL if the request fails.
32
33 free() returns no value.
34
36 tcp_pagein(3z) ,tcp_pageout(3z)
37
38
40 These functions manipulate memory in a private memory page belonging to
41 ZSock. This 16k page holds all the buffers that ZSock uses and hence
42 requests for large amounts of memory are likely to fail (and in any
43 case are not recommended).
44
45 This facility has been offered to allow daemons to be written simply
46 (they have no address space of their own). User applications should not
47 use these facilities. If a large (>256 bytes) amount of memory is
48 required for a user application then the application should either be
49 of the BAD type or be redesigned.
50
51
53 Dominic Morris <dom@jb.man.ac.uk>
54
55
56
57 February 18 2000 tcp_malloc(3)