RtlFreeHeap function (ntifs.h)

The RtlFreeHeap routine frees a memory block that was allocated from a heap by RtlAllocateHeap.

Syntax

NTSYSAPI LOGICAL RtlFreeHeap(
  [in]           PVOID                 HeapHandle,
  [in, optional] ULONG                 Flags,
                 _Frees_ptr_opt_ PVOID BaseAddress
);

Parameters

[in] HeapHandle

A handle for the heap whose memory block is to be freed. This parameter is a handle returned by RtlCreateHeap.

[in, optional] Flags

A set of flags that controls aspects of freeing a memory block. Specifying the following value overrides the corresponding value that was specified in the Flags parameter when the heap was created by RtlCreateHeap.

Flag Meaning
HEAP_NO_SERIALIZE Mutual exclusion will not be used when RtlFreeHeap is accessing the heap.

BaseAddress

A pointer to the memory block to free. This pointer is returned by RtlAllocateHeap.

Return value

RtlFreeHeap returns TRUE if the block was freed successfully; FALSE otherwise.

Note  Starting with Windows 8 the return value is typed as LOGICAL, which has a different size than BOOLEAN.
 

Requirements

Requirement Value
Minimum supported client Available starting in Windows XP.
Target Platform Universal
Header ntifs.h (include Ntifs.h)
Library NtosKrnl.lib
DLL NtosKrnl.exe
IRQL < DISPATCH_LEVEL

See also

RtlAllocateHeap

RtlCreateHeap

RtlDestroyHeap