Memory Management Functions综述

原创 2012年03月29日 15:07:17

This topic describes the memory management 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.
CopyMemory 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.
MoveMemory 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.
ZeroMemory 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
CreateFileMapping 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.
FlushViewOfFile 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.
MapViewOfFile 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.
OpenFileMapping Opens a named file mapping object.
UnmapViewOfFile Unmaps a mapped view of a file from the calling process's address space.

 

AWE Functions

The following are the AWE 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
GetProcessHeap 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.
HeapAlloc Allocates a block of memory from a heap.
HeapCompact Coalesces adjacent free blocks of memory on a heap.
HeapCreate Creates a heap object.
HeapDestroy Destroys the specified heap object.
HeapFree 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.
VirtualAlloc Reserves or commits a region of pages in the virtual address space of the calling process.
VirtualAllocEx 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.
VirtualFree Releases or decommits a region of pages within the virtual address space of the calling process.
VirtualFreeEx 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.
VirtualProtect Changes the access protection on a region of committed pages in the virtual address space of the calling process.
VirtualProtectEx 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.
VirtualQueryEx 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. HeapAlloc
GlobalDiscard, LocalDiscard Discards the specified global memory block. Not applicable.
GlobalFlags, LocalFlags Returns information about the specified global memory object. Not applicable. Use HeapValidate to validate the heap.
GlobalFree, LocalFree Frees the specified global memory object. HeapFree
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:

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

相关文章推荐

[提问]无法定位程序输入点_gmp_get_memory_functions于动太链接库libgmp-3.dll上?[已解决]

这个问题困扰了我很久,在网上找了很多资料也没有找到有人遇到相同的问题,问题显示为: 无法定位程序输入点_gmp_get_memory_functions于动太链接库libgmp-3.dll上 (cc...

Built-in functions for atomic memory access

在linux2.6.18之后,删除了和头文件,编译器提供内建(built-in)原子操作函数。需要在gcc编译选项中指明CPU类型。如gcc -marth=i686 -o hello hello.c。...
  • vinowan
  • vinowan
  • 2011年08月06日 17:26
  • 518

Oracle Memory Management and HugePage

  • 2016年04月12日 14:46
  • 1.2MB
  • 下载

Android Memory Management

从早期G1的192MB RAM开始,到现在动辄1G -2G RAM的设备,为单个App分配的内存从16MB到48MB甚至更多,但OOM从不曾离我们远去。这是因为大部分App中图片内容占据了50%甚至7...

Memory Management in Linux

  • 2009年04月05日 23:30
  • 847KB
  • 下载

virtual memory management in Linux

  • 2012年02月08日 11:48
  • 8.42MB
  • 下载

Wrangling Dalvik: Memory Management in Android (Part 1 of 2)

Wrangling Dalvik: Memory Management in Android (Part 1 of 2) Posted  MARCH 4, 2014 by  JOE MAHON ...

Memory Management in Linux

  • 2008年10月29日 17:24
  • 1.18MB
  • 下载
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:Memory Management Functions综述
举报原因:
原因补充:

(最多只允许输入30个字)