Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All


Adds memory to the heap.

int _heapadd( 
   void *memblock,
   size_t size 


Pointer to heap memory.
Size in bytes of memory to add.

Return Value

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

See _doserrno, errno, _sys_errlist, and _sys_nerr for more information on this, and other, return codes.


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.


Routine Required header Optional headers Compatibility
_heapadd <malloc.h> <errno.h> None

For additional compatibility information, see Compatibility in the Introduction.


All versions of the C run-time libraries.

See Also

Memory Allocation Routines | free | _heapchk | _heapmin | _heapset | _heapwalk | malloc | realloc | Run-Time Routines and .NET Framework Equivalents

© 2015 Microsoft