Memory Management Functions

来源:互联网 发布:四川科教频道 网络直播 编辑:程序博客网 时间:2024/06/06 00:24

Memory Management Functions

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

·    Obsolete Functions

General Memory Functions

The following functions are used in memory management.

Function

Description

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.

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.

GlobalMemoryStatus

Obtains information about the system's current usage of both physical and 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.

ResetWriteWatch

Resets the write-tracking state for a region of virtual memory.

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

Attempts to compact a specified 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

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 slower than other memory management functions and do not provide as many features. Therefore, new applications should use the heap functions. However, the global functions are still used with DDE and the clipboard functions.

Function

Description

GlobalAlloc

Allocates the specified number of bytes from the heap.

GlobalDiscard

Discards the specified global memory block.

GlobalFlags

Returns information about the specified global memory object.

GlobalFree

Frees the specified global memory object.

GlobalHandle

Retrieves the handle associated with the specified pointer to a global memory block.

GlobalLock

Locks a global memory object and returns a pointer to the first byte of the object's memory block.

GlobalReAlloc

Changes the size or attributes of a specified global memory object.

GlobalSize

Retrieves the current size of the specified global memory object.

GlobalUnlock

Decrements the lock count associated with a memory object.

LocalAlloc

Allocates the specified number of bytes from the heap.

LocalDiscard

Discards the specified local memory object.

LocalFlags

Returns information about the specified local memory object.

LocalFree

Frees the specified local memory object.

LocalHandle

Retrieves the handle associated with the specified pointer to a local memory object.

LocalLock

Locks a local memory object and returns a pointer to the first byte of the object's memory block.

LocalReAlloc

Changes the size or the attributes of a specified local memory object.

LocalSize

Returns the current size of the specified local memory object.

LocalUnlock

Decrements the lock count associated with a memory object.

Obsolete Functions

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

·    IsBadCodePtr

·    IsBadReadPtr

·    IsBadStringPtr

·    IsBadWritePtr

 

Send comments about this topic to Microsoft

Build date: 8/15/2007

 

 

原创粉丝点击