VMS Help  —  CRTL  realloc
    Changes the size of the area pointed to by the first argument to
    the number of bytes given by the second argument. These functions
    are AST-reentrant.

    Format

      #include  <stdlib.h>

      void *realloc  (void *ptr, size_t size);

1  –  Function Variants

    The realloc function has variants named _realloc32 and _realloc64
    for use with 32-bit and 64-bit pointer sizes, respectively.

2  –  Arguments

 ptr

    Points to an allocated area, or can be NULL.

 size

    The new size of the allocated area.

3  –  Description

    If ptr is the NULL pointer, the behavior of the realloc function
    is identical to the malloc function.

    The contents of the area are unchanged up to the lesser of the
    old and new sizes. The ANSI C Standard states that, "If the
    new size is larger than the old size, the value of the newly
    allocated portion of memory is indeterminate." For compatibility
    with old implementations, VSI C initializes the newly
    allocated memory to 0.

    For efficiency, the previous actual allocation could have been
    larger than the requested size. If it was allocated with malloc,
    the value of the portion of memory between the previous requested
    allocation and the actual allocation is indeterminate. If it was
    allocated with calloc, that same memory was initialized to 0. If
    your application relies on realloc initializing memory to 0, then
    use calloc instead of malloc to perform the initial allocation.
    The maximum amount of memory allocated at once is limited to
    0xFFFFD000.

    See also free, cfree, calloc, and malloc.

4  –  Return Values

    x                  The address of the area, quadword-
                       aligned (Alpha only) or octaword-aligned
                       (Integrity servers(ONLY)) . The address is
                       returned because the area may have to be moved
                       to a new address to reallocate enough space.
                       If the area was moved, the space previously
                       occupied is freed.
    NULL               Indicates that space cannot be reallocated
                       (for example, if there is not enough room).
Close Help