Memory Management Functions综述

54 篇文章 1 订阅
18 篇文章 0 订阅

This topic describes the memory management functions:

General Memory Functions

The following functions are used in memory management.

FunctionDescription
AddSecureMemoryCacheCallbackRegisters a callback function to be called when a secured memory range is freed or its protections are changed.
CopyMemoryCopies a block of memory from one location to another.
CreateMemoryResourceNotificationCreates a memory resource notification object.
FillMemoryFills a block of memory with a specified value.
GetLargePageMinimumRetrieves the minimum size of a large page.
GetPhysicallyInstalledSystemMemoryRetrieves the amount of RAM that is physically installed on the computer.
GetSystemFileCacheSizeRetrieves the current size limits for the working set of the system cache.
GetWriteWatchRetrieves the addresses of the pages that have been written to in a region of virtual memory.
GlobalMemoryStatusExObtains information about the system's current usage of both physical and virtual memory.
MoveMemoryMoves a block of memory from one location to another.
QueryMemoryResourceNotificationRetrieves the state of the specified memory resource object.
RemoveSecureMemoryCacheCallbackUnregisters a callback function that was previously registered with the AddSecureMemoryCacheCallback function.
ResetWriteWatchResets the write-tracking state for a region of virtual memory.
SecureMemoryCacheCallbackAn application-defined function that is called when a secured memory range is freed or its protections are changed.
SecureZeroMemoryFills a block of memory with zeros.
SetSystemFileCacheSizeLimits the size of the working set for the file system cache.
ZeroMemoryFills a block of memory with zeros.

 

Data Execution Prevention Functions

The following functions are used with Data Execution Prevention (DEP).

FunctionDescription
GetProcessDEPPolicyRetrieves DEP settings for a process.
GetSystemDEPPolicyRetrieves DEP settings for the system.
SetProcessDEPPolicyChanges DEP settings for a process.

 

File Mapping Functions

The following functions are used in file mapping.

FunctionDescription
CreateFileMappingCreates or opens a named or unnamed file mapping object for a specified file.
CreateFileMappingNumaCreates or opens a named or unnamed file mapping object for a specified file, and specifies the NUMA node for the physical memory.
FlushViewOfFileWrites to the disk a byte range within a mapped view of a file.
GetMappedFileNameChecks 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.
MapViewOfFileMaps a view of a file mapping into the address space of a calling process.
MapViewOfFileExMaps 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.
MapViewOfFileExNumaMaps a view of a file mapping into the address space of a calling process, and specifies the NUMA node for the physical memory.
OpenFileMappingOpens a named file mapping object.
UnmapViewOfFileUnmaps a mapped view of a file from the calling process's address space.

 

AWE Functions

The following are the AWE functions.

FunctionDescription
AllocateUserPhysicalPagesAllocates physical memory pages to be mapped and unmapped within any AWE region of the process.
FreeUserPhysicalPagesFrees physical memory pages previously allocated with AllocateUserPhysicalPages.
MapUserPhysicalPagesMaps previously allocated physical memory pages at the specified address within an AWE region.
MapUserPhysicalPagesScatterMaps previously allocated physical memory pages at the specified address within an AWE region.

 

Heap Functions

The following are the heap functions.

FunctionDescription
GetProcessHeapObtains a handle to the heap of the calling process.
GetProcessHeapsObtains handles to all of the heaps that are valid for the calling process.
HeapAllocAllocates a block of memory from a heap.
HeapCompactCoalesces adjacent free blocks of memory on a heap.
HeapCreateCreates a heap object.
HeapDestroyDestroys the specified heap object.
HeapFreeFrees a memory block allocated from a heap.
HeapLockAttempts to acquire the lock associated with a specified heap.
HeapQueryInformationRetrieves information about the specified heap.
HeapReAllocReallocates a block of memory from a heap.
HeapSetInformationSets heap information for the specified heap.
HeapSizeRetrieves the size of a memory block allocated from a heap.
HeapUnlockReleases ownership of the lock associated with a specified heap.
HeapValidateAttempts to validate a specified heap.
HeapWalkEnumerates the memory blocks in a specified heap.

 

Virtual Memory Functions

The following are the virtual memory functions.

FunctionDescription
PrefetchVirtualMemoryPrefetches virtual address ranges into physical memory.
VirtualAllocReserves or commits a region of pages in the virtual address space of the calling process.
VirtualAllocExReserves or commits a region of pages in the virtual address space of the specified process.
VirtualAllocExNumaReserves or commits a region of memory within the virtual address space of the specified process, and specifies the NUMA node for the physical memory.
VirtualFreeReleases or decommits a region of pages within the virtual address space of the calling process.
VirtualFreeExReleases or decommits a region of memory within the virtual address space of a specified process.
VirtualLockLocks the specified region of the process's virtual address space into physical memory.
VirtualProtectChanges the access protection on a region of committed pages in the virtual address space of the calling process.
VirtualProtectExChanges the access protection on a region of committed pages in the virtual address space of the calling process.
VirtualQueryProvides information about a range of pages in the virtual address space of the calling process.
VirtualQueryExProvides information about a range of pages in the virtual address space of the calling process.
VirtualUnlockUnlocks 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.

FunctionDescriptionCorresponding heap function
GlobalAlloc, LocalAllocAllocates the specified number of bytes from the heap.HeapAlloc
GlobalDiscard, LocalDiscardDiscards the specified global memory block.Not applicable.
GlobalFlags, LocalFlagsReturns information about the specified global memory object.Not applicable. Use HeapValidate to validate the heap.
GlobalFree, LocalFreeFrees the specified global memory object.HeapFree
GlobalHandle, LocalHandleRetrieves 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, LocalLockLocks a global memory object and returns a pointer to the first byte of the object's memory block.Not applicable.
GlobalReAlloc, LocalReAllocChanges the size or attributes of a specified global memory object.HeapReAlloc
GlobalSize, LocalSizeRetrieves the current size of the specified global memory object.HeapSize
GlobalUnlock, LocalUnlockDecrements 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.

FunctionDescription
BadMemoryCallbackRoutineAn application-defined function registered with the RegisterBadMemoryNotification function that is called when one or more bad memory pages are detected.
GetMemoryErrorHandlingCapabilitiesGets the memory error handling capabilities of the system.
RegisterBadMemoryNotificationRegisters a bad memory notification that is called when one or more bad memory pages are detected.
UnregisterBadMemoryNotificationCloses the specified bad memory notification handle.

 

Obsolete Functions

The following functions are provided only for compatibility with 16-bit versions of Windows:

The following function can return incorrect information and should not be used. Use the GlobalMemoryStatusEx function instead:

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值