Platform SDK: Memory

FreeUserPhysicalPages

The FreeUserPhysicalPages function frees physical memory pages previously allocated with AllocateUserPhysicalPages. If any of these pages are currently mapped in the AWE region, they are automatically unmapped by this call. Note this does not affect the virtual address space occupied by the specified AWE region.

BOOL FreeUserPhysicalPages(
  HANDLE hProcess,            // handle to process
  PULONG_PTR NumberOfPages,   // pages to free
  PULONG_PTR UserPfnArray     // virtual address
);

Parameters

hProcess
[in] Handle to a process. The function frees memory within the virtual address space of this process.
NumberOfPages
[in/out] Specifies the size, in pages, of the physical memory to free. On return, if the function failed, this parameter indicates the number of pages freed.
UserPfnArray
[in] Specifies the virtual address to obtain the page frame numbers to free.

Return Values

If the function succeeds, the return value is TRUE.

If the function fails, the return value is FALSE. In this case, the NumberOfPages parameter will reflect how many pages have actually been released. To get extended error information, call GetLastError.

Remarks

In a multiprocessor environment, this function maintains coherence of the hardware translation buffer. Upon return from this function, all threads on all processors are guaranteed to see the correct mapping.

Requirements

  Windows NT/2000: Requires Windows 2000.
  Windows 95/98: Unsupported.
  Header: Declared in Winbase.h; include Windows.h.
  Library: Use Kernel32.lib.

See Also

Memory Management Overview, Memory Management Functions, Address Windowing Extensions, AllocateUserPhysicalPages, MapUserPhysicalPages, MapUserPhysicalPagesScatter