Copyright Digital Equipment Corp. All rights reserved.

Description

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

                                  NOTE

      The malloc routines call 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, 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 three levels of hierarchy:

      1. 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.

      2. 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.

      3. At the lowest level are the Memory Management System
         Services, such as $CRETVA and $EXPREG, that provide
         extensive control over address space allocation. At this
         level, you must manage the allocation precisely.

   The maximum amount of memory allocated at once is limited to
   0xFFFFD000.