博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
[转]Memory Management Functions
阅读量:6912 次
发布时间:2019-06-27

本文共 8113 字,大约阅读时间需要 27 分钟。

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.功能类是copymemory,不过源地址和目的地址可以相同。

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.销毁由heapalloc和heaprealloc所分配的内存

HeapFree

Frees a memory block allocated from a heap.释放有heapcreate所分配的内存

HeapLock

Attempts to acquire the lock associated with a specified heap.将globalalloc和globrealloc分配的属性为GMEM_MOVEABLE的内存块设为固定

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.类似VirtualAlloc功能,不过可以为其他进程分配内存。

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.释放有virtualallocex分配的内存,功能、使用方法和virtualfree类似。

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判断调用进程是否拥有对指定地址段内存的写操作权限

 

Build date: 8/15/2007

【参考资料 感谢作者】

1、摘自MSDN2008本地 

转载地址:http://wvncl.baihongyu.com/

你可能感兴趣的文章
selenium+python自动化95-弹出框死活定位不到
查看>>
[Asp.net core]使用Polly网络请求异常重试
查看>>
Java探针-Java Agent技术-阿里面试题
查看>>
densenet
查看>>
user-agent
查看>>
基于Redis+MySQL+MongoDB存储架构应用
查看>>
thymeleaf 的hello world
查看>>
js pjax 和window.history.pushState,replaceState
查看>>
Hadoop Yarn REST API未授权漏洞利用挖矿分析
查看>>
asp.net Core 获取应用程序所在目录的2种方式
查看>>
Android震动vibrator(马达)--系统到驱动的流程【转】
查看>>
Linux下分布式系统以及CAP理论分析
查看>>
Oracle与Sql server的区别
查看>>
JavaScript 判断一个对象{}是否为空对象的简单方法
查看>>
C#使用Xamarin开发可移植移动应用(1.入门与Xamarin.Forms页面),附源码
查看>>
java 正则例子
查看>>
拆系数FFT
查看>>
SpringBoot乱码
查看>>
MySQL远程连接失败(错误码:2003)
查看>>
EMQ 注意事项
查看>>