RtlDestroyHeap - NtDoc

Native API online documentation, based on the System Informer (formerly Process Hacker) phnt headers
#ifndef _NTRTL_H

/**
 * The RtlDestroyHeap routine destroys the specified heap object. RtlDestroyHeap decommits and releases all the pages of a private heap object,
 * and it invalidates the handle to the heap.
 *
 * \param HeapHandle Handle for the heap to be destroyed. This parameter is a heap handle returned by RtlCreateHeap.
 * \return If the call to RtlDestroyHeap succeeds, the return value is a NULL pointer. If the call to RtlDestroyHeap fails, the return value is a handle for the heap.
 * \remarks https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/ntifs/nf-ntifs-rtldestroyheap
 * \remarks Own private heaps created for the component; do not destroy the process default heap. DestroyHeap returns NULL on successful destruction and can return the original handle on failure. All allocations and references from a destroyed heap become invalid; use the correct heap for every block operation.
 */
_Success_(return == 0)
NTSYSAPI
PVOID
NTAPI
RtlDestroyHeap(
    _In_ _Post_invalid_ HANDLE HeapHandle
    );

#endif

View code on GitHub
// ntifs.h

NTSYSAPI PVOID RtlDestroyHeap(
  [in] PVOID HeapHandle
);
View the official Windows Driver Kit DDI reference

NtDoc

No description available.

Windows Driver Kit DDI reference (nf-ntifs-rtldestroyheap)

RtlDestroyHeap function

Description

The RtlDestroyHeap routine destroys the specified heap object. RtlDestroyHeap decommits and releases all the pages of a private heap object, and it invalidates the handle to the heap.

Parameters

HeapHandle [in]

Handle for the heap to be destroyed. This parameter is a heap handle returned by RtlCreateHeap.

Return value

If the call to RtlDestroyHeap succeeds, the return value is a NULL pointer.

If the call to RtlDestroyHeap fails, the return value is a handle for the heap.

Remarks

Processes can call RtlDestroyHeap without first calling RtlFreeHeap to free memory that was allocated from the heap.

See also

RtlAllocateHeap

RtlCreateHeap

RtlFreeHeap


NTinternals.net (undocumented.ntinternals.net)

This function is documented in Windows Driver Kit.


HeapHandle

Pointer to heap memory block.

See also