Annotation of researchv10dc/man/adm/man3/malloc.3, revision 1.1

1.1     ! root        1: .TH MALLOC 3 
        !             2: .CT 2 mem_man
        !             3: .SH NAME
        !             4: malloc, free, realloc, calloc, cfree \- memory allocator
        !             5: .SH SYNOPSIS
        !             6: .nf
        !             7: .B char *malloc(size)
        !             8: .B unsigned size;
        !             9: .PP
        !            10: .B free(ptr)
        !            11: .B char *ptr;
        !            12: .PP
        !            13: .B char *realloc(ptr, size)
        !            14: .B char *ptr;
        !            15: .B unsigned size;
        !            16: .PP
        !            17: .B char *calloc(nelem, elsize)
        !            18: .B unsigned nelem, elsize;
        !            19: .PP
        !            20: .B cfree(ptr)
        !            21: .B char *ptr;
        !            22: .fi
        !            23: .SH DESCRIPTION
        !            24: .I Malloc
        !            25: and
        !            26: .I free
        !            27: provide a simple memory allocation package.
        !            28: .I Malloc
        !            29: returns a pointer to a new block of at least
        !            30: .I size
        !            31: bytes.
        !            32: The block is suitably aligned for storage of any type of object.
        !            33: No two active pointers from
        !            34: .I malloc
        !            35: will have the same value.
        !            36: .PP
        !            37: The argument to
        !            38: .I free
        !            39: is a pointer to a block previously allocated by
        !            40: .IR malloc ;
        !            41: this space is made available for further allocation.
        !            42: .PP
        !            43: .I Realloc
        !            44: changes the size of the block pointed to by
        !            45: .I ptr
        !            46: to
        !            47: .I size
        !            48: bytes and returns a pointer to the (possibly moved)
        !            49: block.
        !            50: The contents will be unchanged up to the
        !            51: lesser of the new and old sizes.
        !            52: The call
        !            53: .B "realloc((char*)0, size)
        !            54: means the same as
        !            55: .LR malloc(size) .
        !            56: .PP
        !            57: .I Calloc
        !            58: allocates space for
        !            59: an array of
        !            60: .I nelem
        !            61: elements of size
        !            62: .I elsize.
        !            63: The space is initialized to zeros.
        !            64: .I Cfree
        !            65: frees such a block.
        !            66: .SH SEE ALSO
        !            67: .IR galloc (3), 
        !            68: .IR brk (2),
        !            69: .IR pool (3),
        !            70: .IR block (3)
        !            71: .SH DIAGNOSTICS
        !            72: .I Malloc, realloc
        !            73: and
        !            74: .I calloc
        !            75: return 0 if there is no available memory
        !            76: or if the arena has been detectably corrupted.
        !            77: .SH BUGS
        !            78: When
        !            79: .I realloc
        !            80: returns 0, the block pointed to by
        !            81: .I ptr
        !            82: may have been destroyed.
        !            83: .PP
        !            84: User errors can corrupt the storage arena.
        !            85: The most common gaffes are (1) freeing an already freed block,
        !            86: (2) storing beyond the bounds of an allocated block, and (3)
        !            87: freeing data that was not obtained from the allocator.
        !            88: To help find such errors, a diagnosing allocator
        !            89: may be loaded; use flag 
        !            90: .B -ldmalloc
        !            91: of
        !            92: .IR cc (1).
        !            93: An even more stringently checking version may be created
        !            94: by recompilation; see the source.

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.