Widows Task Manager/MEM usage/VM Size

Source: Internet
Author: User

The easiest way to check whether memory leakage exists is to view the task manager.

Physical memory and virtual memory

To understand the innerProgramFirst, you need to understand how to allocate memory to programs from the operating system. Every process on the computer thinks that it can access all the physical memory. Obviously, since multiple programs are running at the same time, each process cannot have all the memory. In fact, these processes use
Virtual Memory.

Just as an example, let's assume that your program is accessing the memory address of 629. However, the virtual memory system does not need to store it in a 629-bit RAM (random access memory. In fact, it may not even be in Ram-if the physical Ram is full, it may even have been transferred to the hard disk! Because these addresses do not have to reflect the physical location of the memory, they are called virtual memory. The operating system maintains a table for converting virtual addresses to physical addresses so that computer hardware can correctly respond to address requests. In addition, if the address is on the hard disk rather than in Ram, the operating system will temporarily stop your process, transfer other memory to the hard disk, and load the requested memory from the hard disk, then restart your process. In this way, each process obtains the address space that you can use to access more memory than the memory installed on your physical server.

On a 32-bit x86 system, each process can access 4 GB memory. Currently, most people do not have 4 GB of memory on their systems, even if you calculate swap,Each process
The memory used must be less than 4 GB. Therefore, when a process is loaded, it getsSystem break)The initial memory allocation of a specific address. This address is followed by unmapped memory-used for memory that is not allocated to the corresponding physical location in Ram or hard disk. Therefore, if a process runs beyond its initial memory allocation, it must request the operating system to "map in" more memory. (Ing is a mathematical term that represents a one-to-one correspondence. When a memory virtual address has a corresponding physical address to store memory content, the memory will be mapped .)

In a multitasking environment, the total memory used by all processes can exceed the computer's physical memory. Under certain circumstances, a part of the process may be deleted from the physical memory and saved to the hard disk file (page file ), when a process tries to access the memory of these files exchanged to the hard disk, the system will generate a page fault ), at this time, the Windows Memory Manager will re-transfer the corresponding memory page from the hard disk to the physical memory.

The physical memory that a process can directly access within a certain period of time (without page interruption) is called the working set of the process; the memory that a process actually allocates (COMMIT) from a 4G address space is called committed virtual memory. Committed VM may exist in page file, while working set must be in physical memory.

The mem usage name is somewhat misleading. It only indicates the physical memory occupied by the process, that is, the working set. The working set does not indicate that the process currently occupies all the virtual memory. Some data may be exchanged to the page file. The data is loaded to the physical memory only when accessed.

Task Manager has another column of data: VM Size, indicating the virtual memory allocated by a process (committed visual memory)

Therefore, the conclusion is very simple: when a Windows program is minimized, the Windows Memory Manager minimizes the working set of the process (based on first-in-first-out FIFO or least-recently LRU ), swap most of the data into the page file. This is easy to understand: We usually want to leave more physical memory for foreground applications to achieve better performance. When the program is restored from a minimum, Windows does not fully load all the virtual memory of the program, but only loads the necessary part. This is also easy to understand:CodeIt is usually seldom accessed after startup


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.