Share

acad_realloc

C++

ACDBCORE2D_PORT void * acad_realloc(
    void * p, 
    size_t size
);

File

acmem.h

Description

These general-purpose memory allocation functions are deprecated in favor of the memory management functions declared in dbmem.h.

Takes a pointer to a memory region previously allocated by one of the standard functions and changes its size while preserving its contents.

If the function succeeds, it returns a pointer to the memory region, which might be new. Returns a null pointer if the function fails.

If the p argument is null, the function behaves like acad_malloc(). If p is not null and size is 0, acad_realloc() returns a null pointer and the old region is deallocated.

If the region's new size is smaller than the old size, some previously stored data is lost. If the region's new size exceeds the old, the old data is preserved, and new, uninitialized space is added at the end.

Note If acad_realloc() doesn't return the pointer that it was passed, do not attempt to use the old region of memory. It was deallocated.

Parameters

Parameters Description
p Input pointer to existing allocated memory that is to be reallocated
size Input desired number of bytes to be allocated

Was this information helpful?