/sys$common/syshlp/helplib.hlb
CC, Run-time functions, malloc

 *Conan The Librarian (sorry for the slow response - running on an old VAX)

  Allocates an area of memory.  This function is AST-reentrant.

  This function allocates a contiguous area of memory whose size, in
  bytes, is supplied as an argument.  The space is not initialized.

  Syntax:

       #include <stdlib.h>

       void *malloc(size_t size);

       Note:

       The malloc routines calls the system routine LIB$VM_MALLOC.
       Because LIB$VM_MALLOC is designed as a general purpose routine
       to allocate
       memory, it is called upon in a wide array of scenarios to
       allocate and reallocate blocks efficiently. The most common
       usage
       is the management of smaller blocks of memory, and the most
       important
       aspect of memory allocation under these circumstances is
       efficiency.

       LIB$VM_MALLOC makes use of its own free space to satisfy
       requests, once the
       heap storage is consumed by splitting large blocks and merging
       adjacent blocks.
        Memory can still become fragmented, leaving unused blocks.
       Once heap storage
       is consumed, LIB$VM_MALLOC manages its own free space and
       merged blocks to
       satisfy requests, but varying sizes of memory allocations can
       cause blocks to
       be left unused.

       Because LIB$VM_MALLOC cannot be made to satisfy all situations
       in the best
       possible manner, you should perform your own memory management
       if you have
       special memory usage needs. This assures the best use of
       memory for
       your particular application.

       The OpenVMS Programming Concepts Manual explains the several
       memory
       allocation routines that are available.  They are grouped into
       3
       levels of hierarchy:

        o  At the highest level are the RTL Heap Management
           Routines LIB$GET_VM and LIB$FREE_VM, which provide a
           mechanism
           for allocating and freeing blocks of memory of arbitrary
           size.  Also
           at this level are the routines based on the concept of
           zones, such as
           LIB$CREATE_VM_ZONE, and so on.

        o  At the next level are the RTL Page Management
           routines LIB$GET_VM_PAGE and LIB$FREE_VM_PAGE, which
           allocate
           a specified number of contiguous pages.

        o  At the lowest level are the Memory Management System
           Services such as
           $CRETVA and $EXPREG that provide extensive control over
           address space
           allocation.  Note that at the this level, you must manage
           the allocation
           precisely.
  Close     HLB-list     TLB-list     Help  

[legal] [privacy] [GNU] [policy] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.