Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer


Releases unused heap memory to the operating system.

int _heapmin( void );

Return Value

If successful, _heapmin 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.


The _heapmin function minimizes the heap by releasing unused heap memory to the operating system.

Note   In 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, the only Win32 platform that is supported by _heapmin is Windows NT. The function returns –1 and sets errno to ENOSYS, when it is called by any other Win32 platform.


Routine Required header Optional headers Compatibility
_heapmin <malloc.h> <errno.h> Win NT, Win 2000, Win XP

For additional compatibility information, see Compatibility in the Introduction.


All versions of the C run-time libraries.

See Also

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

© 2015 Microsoft