M286

Section: Miscellaneous Library Functions (3X)
Index Return to Main Contents
 

NAME

m286 - malloc package for iAPX286 processor  

SYNOPSIS

        char *malloc(size)
        unsigned size;

        void free(ptr)
        char *ptr;

        char *realloc(ptr, size)
        char *ptr;
        unsigned size;

        char calloc(nelem, elsize)
        unsigned nelem, elsize;

        int dump_malloc()
 

DESCRIPTION

M286 is a malloc(3C) compatible library designed for use on the iAPX286 processor. Performance is greatly improved over both malloc(3C) and malloc(3X) by allocating full 64K segments via the brk() system call and divving up the segments as needed, reducing UNIX overhead. Is is found in the library "m286", and is loaded if the option "-lm286" is used with cc(1) or ld(1).

Malloc returns a pointer to a block of at least size bytes.

Free returns the space previously allocated with calloc() or malloc() as pointed to by the argument ptr. Contents of the block are preserved until the next malloc() or calloc() call.

Realloc changes the size of the blocked pointed to by ptr to the size given by argument two in bytes. Contents of the block will be unchanged up to either the original size or the new size, whichever is smaller.

Calloc allocates space via malloc and intializes the space to zeros. The amount of space allocated is set up to handle an array of nelem elements of size elsize.

Dump_malloc provides a means to debug pointer references by dumping a list of all blocks within m286's free list or those currently allocated to the standard error device. The listing contains LLINK, RLINK which are pointers to the previous and next blocks on the free list. TAG and ETAG are flags indicating whether the block is in use or not. ULINK is always a pointer to the beginning of the block. All of the fields are displayed as indexes into a array of words within the allocated segment.

 

CAVEATS

Since performance is gained by allocating full 64K segments, an average of 32K bytes will be wasted by the process. The maximum size block that can be allocated is 65488 bytes. If larger sizes are needed, use brk() directly.

This software is copyright and can only be used and distributed for non-commercial use. Commerical licenses can be obtained from mike@cimcor.mn.org for a very low cost.  

FILES

/usr/lib/large/libm286.a  

SEE ALSO

malloc(3c), malloc(3x), brk(2)


 

Index

NAME
SYNOPSIS
DESCRIPTION
CAVEATS
FILES
SEE ALSO

This document was created by man2html, using the manual pages.
Time: 07:09:13 GMT, December 12, 2024