For the latest documentation on Visual Studio 2017 RC, see Visual Studio 2017 RC Documentation.

Adds memory to the heap.

System_CAPS_ICON_important.jpg Important

This function is obsolete. Beginning in Visual Studio 2015, it is not available in the CRT.

int _heapadd(   
   void *memblock,  
   size_t size   


Pointer to the heap memory.

Size of memory to add, in bytes.

If successful, _heapadd returns 0; otherwise, the function returns –1 and sets errno to ENOSYS.

For more information about this and other return codes, see _doserrno, errno, _sys_errlist, and _sys_nerr.

Beginning with Visual C++ version 4.0, the underlying heap structure was moved to the C run-time libraries to support the new debugging features. As a result, _heapadd is no longer supported on any platform that is based on the Win32 API.

RoutineRequired headerOptional header

For more compatibility information, see Compatibility in the Introduction.

Not applicable. To call the standard C function, use PInvoke. For more information, see Platform Invoke Examples.

Memory Allocation