malloc man page on IRIX

Man page or keyword search:  
man Server   31559 pages
apropos Keyword Search (all sections)
Output format
IRIX logo
[printable version]



MALLOC(3F)							    MALLOC(3F)

NAME
     malloc, free - main memory allocator

FORTRAN SYNOPSIS
     pointer (iptr, arr)
     dimension arr(1)
     integer nbytes

     iptr = malloc(nbytes)

     call free(iptr)

DESCRIPTION
     malloc and free provide a simple general-purpose memory allocation
     package.  malloc returns a pointer to a block of at least nbytes bytes
     suitably aligned for any use.

     arr can be an array of any type.  After the call to malloc the array arr
     can be used as if it has been declared as an array with nbytes in length.
     All references to this array will be deferenced using the value assigned
     to iptr in the malloc call to refer to the space allocated by malloc.

     The argument to free is a pointer to a block previously allocated by
     malloc; after free is performed this space is made available for further
     allocation, but its contents are left undisturbed.

     Undefined results will occur if the space assigned by malloc is overrun
     or if some random number is handed to free.

     malloc allocates the first big enough contiguous reach of free space
     found in a circular search from the last block allocated or freed,
     coalescing adjacent free blocks as it searches.  It calls sbrk [see
     brk(2)] to get more memory from the system when there is no suitable
     space already free.

DIAGNOSTICS
     malloc, returns a NULL pointer if there is no available memory or if the
     arena has been detectably corrupted by storing outside the bounds of a
     block.  When this happens the block pointed to by iptr may be destroyed.

NOTES
     Search time increases when many objects have been allocated; that is, if
     a program allocates but never frees, then each successive allocation
     takes longer.

     Note that the system may be configured with virtual swap space.  This
     allows processes to allocate more virtual memory than is actually
     available, allowing the use of sparse addressing, successful forks and
     subsequent execs by programs larger than 1/2 the available virtual
     memory, and so forth.  Thus programs using malloc may get a successful
     return, but later be sent the SIGKILL signal if virtual memory was
     overcommitted, and processes attempt to actually use all of the

									Page 1

MALLOC(3F)							    MALLOC(3F)

     overcommitted memory.  If the system has no virtual swap space
     configured, then processes are limited to using no more virtual memory
     than the sum of physical memory and swap space.  See the section on
     "Logical Swap Space" in the swap(1M) man page for more information.

									Page 2

[top]

List of man pages available for IRIX

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net