記憶體管理函式

記憶體管理函式包括:通用記憶體函式、數據執行保護函式、檔案映射函式等

基本介紹

  • 中文名:記憶體管理函式
  • 外文名:Memory Management Function
  • 包括1:Bad Memory Functions
  • 包括2:Heap Functions
函式內容
Memory Management Function
This topic describes the memory management functions:
General Memory Functions(通用記憶體函式)
Data Execution Prevention Functions(數據執行保護函式)
File Mapping Functions(檔案映射函式)
AWE Functions(地址視窗擴展函式)
Heap Functions(堆函式)
Virtual Memory Functions(虛擬記憶體函式)
Global and Local Functions
Bad Memory Functions
Obsolete Functions(已停用的函式)
General Memory Functions
The following functions are used in memory management.
Function
Description
AddSecureMemoryCacheCallback
Registers a callback function to be called when a secured memory range is freed or its protections are changed.
Copies a block of memory from one location to another.
CreateMemoryResourceNotification
Creates a memory resource notification object.
FillMemory
Fills a block of memory with a specified value.
GetLargePageMinimum
Retrieves the minimum size of a large page.
GetPhysicallyInstalledSystemMemory
Retrieves the amount of RAM that is physically installed on the computer.
GetSystemFileCacheSize
Retrieves the current size limits for the working set of the system cache.
GetWriteWatch
Retrieves the addresses of the pages that have been written to in a region of virtual memory.
GlobalMemoryStatusEx
Obtains information about the system's current usage of both physical and virtual memory.
Moves a block of memory from one location to another.
QueryMemoryResourceNotification
Retrieves the state of the specified memory resource object.
RemoveSecureMemoryCacheCallback
Unregisters a callback function that was previously registered with the AddSecureMemoryCacheCallback function.
ResetWriteWatch
Resets the write-tracking state for a region of virtual memory.
SecureMemoryCacheCallback
An application-defined function that is called when a secured memory range is freed or its protections are changed.
SecureZeroMemory
Fills a block of memory with zeros.
SetSystemFileCacheSize
Limits the size of the working set for the file system cache.
Fills a block of memory with zeros.
Data Execution Prevention Functions
The following functions are used with Data Execution Prevention (DEP).
Function
Description
GetProcessDEPPolicy
Retrieves DEP settings for a process.
GetSystemDEPPolicy
Retrieves DEP settings for the system.
SetProcessDEPPolicy
Changes DEP settings for a process.
File Mapping Functions
The following functions are used in file mapping.
Function
Description
Creates or opens a named or unnamed file mapping object for a specified file.
CreateFileMappingNuma
Creates or opens a named or unnamed file mapping object for a specified file, and specifies the NUMA node for the physical memory.
Writes to the disk a byte range within a mapped view of a file.
GetMappedFileName
Checks whether the specified address is within a memory-mapped file in the address space of the specified process. If so, the function returns the name of the memory-mapped file.
Maps a view of a file mapping into the address space of a calling process.
MapViewOfFileEx
Maps a view of a file mapping into the address space of a calling process. A caller can optionally specify a suggested memory address for the view.
MapViewOfFileExNuma
Maps a view of a file mapping into the address space of a calling process, and specifies the NUMA node for the physical memory.
Opens a named file mapping object.
Unmaps a mapped view of a file from the calling process's address space.
AWE Functions
The following are theAWE functions.
Function
Description
AllocateUserPhysicalPages
Allocates physical memory pages to be mapped and unmapped within any AWE region of the process.
FreeUserPhysicalPages
Frees physical memory pages previously allocated with AllocateUserPhysicalPages.
MapUserPhysicalPages
Maps previously allocated physical memory pages at the specified address within an AWE region.
MapUserPhysicalPagesScatter
Maps previously allocated physical memory pages at the specified address within an AWE region.
Heap Functions
The following are the heap functions.
Function
Description
Obtains a handle to the heap of the calling process.
GetProcessHeaps
Obtains handles to all of the heaps that are valid for the calling process.
Allocates a block of memory from a heap.
HeapCompact
Coalesces adjacent free blocks of memory on a heap.
Creates a heap object.
HeapDestroy
Destroys the specified heap object.
Frees a memory block allocated from a heap.
HeapLock
Attempts to acquire the lock associated with a specified heap.
HeapQueryInformation
Retrieves information about the specified heap.
HeapReAlloc
Reallocates a block of memory from a heap.
HeapSetInformation
Sets heap information for the specified heap.
HeapSize
Retrieves the size of a memory block allocated from a heap.
HeapUnlock
Releases ownership of the lock associated with a specified heap.
HeapValidate
Attempts to validate a specified heap.
HeapWalk
Enumerates the memory blocks in a specified heap.
Virtual Memory Functions
The following are the virtual memory functions.
Function
Description
PrefetchVirtualMemory
Prefetches virtual address ranges into physical memory.
Reserves or commits a region of pages in the virtual address space of the calling process.
Reserves or commits a region of pages in the virtual address space of the specified process.
VirtualAllocExNuma
Reserves or commits a region of memory within the virtual address space of the specified process, and specifies the NUMA node for the physical memory.
Releases or decommits a region of pages within the virtual address space of the calling process.
Releases or decommits a region of memory within the virtual address space of a specified process.
VirtualLock
Locks the specified region of the process's virtual address space into physical memory.
Changes the access protection on a region of committed pages in the virtual address space of the calling process.
Changes the access protection on a region of committed pages in the virtual address space of the calling process.
VirtualQuery
Provides information about a range of pages in the virtual address space of the calling process.
Provides information about a range of pages in the virtual address space of the calling process.
VirtualUnlock
Unlocks a specified range of pages in the virtual address space of a process.
Global and Local Functions
The following are the global and local functions. These functions are provided for compatibility with 16-bit Windows and are used with Dynamic Data Exchange (DDE), the clipboard functions, and OLE data objects. Unless documentation specifically states that a global or local function should be used, new applications should use the corresponding heap function with the handle returned by GetProcessHeap. For equivalent functionality to the global or local function, set the heap function's dwFlags parameter to 0.
Function
Description
Corresponding heap function
GlobalAlloc, LocalAlloc
Allocates the specified number of bytes from the heap.
GlobalDiscard, LocalDiscard
Discards the specified global memory block.
Not applicable.
GlobalFlags, LocalFlags
Returns information about the specified global memory object.
Not applicable. Use HeapValidateto validate the heap.
GlobalFree, LocalFree
Frees the specified global memory object.
GlobalHandle, LocalHandle
Retrieves the handle associated with the specified pointer to a global memory block. This function should be used only with OLE and clipboard functions that require it.
Not applicable.
GlobalLock, LocalLock
Locks a global memory object and returns a pointer to the first byte of the object's memory block.
Not applicable.
GlobalReAlloc, LocalReAlloc
Changes the size or attributes of a specified global memory object.
HeapReAlloc
GlobalSize, LocalSize
Retrieves the current size of the specified global memory object.
HeapSize
GlobalUnlock, LocalUnlock
Decrements the lock count associated with a memory object. This function should be used only with OLE and clipboard functions that require it.
Not applicable.
Bad Memory Functions
The following are the bad memory functions.
Function
Description
BadMemoryCallbackRoutine
An application-defined function registered with the RegisterBadMemoryNotification function that is called when one or more bad memory pages are detected.
GetMemoryErrorHandlingCapabilities
Gets the memory error handling capabilities of the system.
RegisterBadMemoryNotification
Registers a bad memory notification that is called when one or more bad memory pages are detected.
UnregisterBadMemoryNotification
Closes the specified bad memory notification handle.
Obsolete Functions
The following functions are provided only for compatibility with 16-bit versions of Windows:
IsBadCodePtr
IsBadReadPtr
IsBadStringPtr
The following function can return incorrect information and should not be used. Use the GlobalMemoryStatusEx function instead:

相關詞條

熱門詞條

聯絡我們