#include <stdlib.h>
void *realloc(void *ptr,
size_t size);
The realloc() function changes the size of the object
pointed to by ptr to the size specified by size,
and returns a pointer to the possibly moved block.
The contents are unchanged up to the lesser of the new and old sizes.
If ptr is null, realloc() behaves like
malloc() for the specified size. If size
is zero (0) and ptr is not a null pointer, the object
pointed to is freed.
- ptr
-
Points to a memory block.
- size
-
Specifies the new size of the memory block.
The realloc() function returns a null pointer if no memory
is available. When realloc() returns null, the block
pointed to by ptr is left intact. If size
is zero (0), a unique pointer to the area is returned.
ANSI/ISO 9899-1990.
MT-Safe.
The realloc() function
allocates from a private heap. Do not mix with Win32 heap
allocation functions. Memory allocated with realloc()
should only be freed with free().
Unlike many UNIX platforms, the heap that is used by
malloc(), calloc(), and
realloc() is not guaranteed to be one contiguous
piece of memory. Thus it is invalid to assume that all memory
between two pointers returned by these functions is
accessible, and it is invalid to compare pointers returned by
these functions to determine the total size of the heap.
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition
- Functions:
- calloc(), free(), malloc(), memalign(), valloc()
PTC MKS Toolkit 10.5 Documentation Build 40.