Operations and functions that increment virtual bytes

After some problems with running out of memory with a 32-bit process on Windows, I started using Performance Monitor to log specific counters for this process.

Although it is normal that virtual bytes are higher than both private bytes and working set, I found that in my case, the significant difference in Virtual Btes was much higher than that of private bytes and working set.

What specific operations and functions of Win32 / CRT (in C or C ++) will increase virtual bytes, but not private bytes and working set?

I assume that these will be some common resources, if I understand the description of different counters in Performance Monitor.


It seems that there is some (at least) confusion in the naming convention for use in memory calculations in different versions of Windows, as well as in different applications in the same version of Windows, I put together the following:

Information from MSDN

According to MSDN - memory limits for a Windows release , the 32-bit Windows user mode virtual address space limit for each 32-bit process is usually 2 GB. It can be up to 3 GB with IMAGE_FILE_LARGE_ADDRESS_AWAREand 4GT.

The following is a description of the various counters in the performance monitor along with the corresponding columns in the task manager and the Win32 structure, which contains information in accordance with the MSDN - Memory Performance Information .

Virtual bytes

- , . . , .

XP: N/A
Vista: N/A
: MEMORYSTATUSEX.ullTotalVirtual-MEMORYSTATUSEX.ullAvailVirtual

- , , .

XP:
Vista:
: PROCESS_MEMORY_COUNTERS_EX.PrivateUsage

- . - , . , , . , . , .

XP: Mem

Vista:
: PROCESS_MEMORY_COUNTERS_EX.WorkingSetSize

+3
3

, () , :

  • (, ), .

  • VirtualAlloc / . .

  • ( )

+2

VirtualAlloc, . , .

, .

+1

What is your programming language?

In managed frames, private bytes are data that is allocated by unmanaged resources. While virtual bytes represent shared memory usage (unmanaged and managed data).

Thus, very often there are significant differences between private and virtual bytes in such a framework.

0
source

Source: https://habr.com/ru/post/1720343/


All Articles