Share via


HeapCompact (Windows CE 5.0)

Send Feedback

This function attempts to compact a specified heap by coalescing adjacent free blocks of memory and decommitting large free blocks of memory.

UINT HeapCompact( HANDLEhHeap,DWORDdwFlags );

Parameters

  • hHeap
    [in] Handle to the heap to be compacted.

    This parameter is a handle returned by the HeapCreate or GetProcessHeap function.

  • dwFlags
    [in] Heap access options.

    The following table shows the flag you can specify.

    Value Description
    HEAP_NO_SERIALIZE Is ignored. The heap is always serialized.

Return Values

If the function succeeds, the return value is the size of the largest committed free block in the heap, in bytes.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

In the unlikely case that there is no space available in the heap, the function return value is zero, and GetLastError returns the value NO_ERROR.

Remarks

There is no guarantee that an application can successfully allocate a memory block of the size returned by HeapCompact. Other threads or the commit threshold might prevent such an allocation.

Requirements

OS Versions: Windows CE 5.0 and later.
Header: Winbase.h.
Link Library: Coredll.lib.

See Also

GetLastError | GetProcessHeap | HeapCreate

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.