Windows application 内存使用分析
一. windows 存储系统:物理存储器分为三类:
1. 物理内存:RAM存储器,即通常说的电脑内存;
2. 页交换文件(paging file):硬盘上提供的虚拟内训;
可以通过以下方式来改变页交换文件的大小:
3. 内存映射问文件(memory-maping file): 存在于硬盘上的文件(EXE/DLL/Data).
二. Windows application内存使用分析指标
1. Virtual Size:
The current size, in bytes, that has been reserved, of the virtual address space for this process. The virtual address space limit of a user mode process is 2 GB, unless 3 GB address space is enabled by using the /3GB switch in boot.ini for 32-bit Windows.
2. Private Bytes:
The current number of bytes this process has committhat cannot be shared with other processes.
It does not include the shared memory, such as EXE, DLL and memory-mapped file.
3. Working Set:
The set of memory pages (areas of memory commit to a process) recently usedby the threads in a process.
It include the shared memory with other process, such as memory-mapped file, various other resources.
它分为2部分: private working set: 不包含共享内存在内的正在使用的物理存储器;
sharable working set: 可以共享的正在使用的物理存储器;
If available memory on the server is above a specified threshold, pages remain in the Working Set of a process even if they are not in use. When available memory falls below a specified threshold, pages are removed from the Working Set. If these pages are needed, they will be returned back to the Working Set before they leave main memory and are made available for other processes to use.
4. 一些结论:
(1)Virtual Size 一定大于或等于Private Bytes 和Working Set;
(2)在共享数据不多的情况下,一般Private Bytes 大于Working Set;
(3)在共享数据比较多的情况下,Working Set 大于 Private Bytes ;
三. App内存使用分析工具
1. Process Explore
使用此工具可以直接看到3项纪录:
2. Windows Task Manager
VM Size(提交大小) : private bytes
Memory Usage(工作设置(内存)): working set