What is private bytes, virtual bytes, working set?

后端 未结 4 1288
暗喜
暗喜 2020-11-22 10:10

I am trying to use the perfmon windows utility to debug memory leaks in a process.

This is how perfmon explains the terms:

Working Set is th

4条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-22 10:54

    The definition of the perfmon counters has been broken since the beginning and for some reason appears to be too hard to correct.

    A good overview of Windows memory management is available in the video "Mysteries of Memory Management Revealed" on MSDN: It covers more topics than needed to track memory leaks (eg working set management) but gives enough detail in the relevant topics.


    To give you a hint of the problem with the perfmon counter descriptions, here is the inside story about private bytes from "Private Bytes Performance Counter -- Beware!" on MSDN:

    Q: When is a Private Byte not a Private Byte?

    A: When it isn't resident.

    The Private Bytes counter reports the commit charge of the process. That is to say, the amount of space that has been allocated in the swap file to hold the contents of the private memory in the event that it is swapped out. Note: I'm avoiding the word "reserved" because of possible confusion with virtual memory in the reserved state which is not committed.


    From "Performance Planning" on MSDN:

    3.3 Private Bytes

    3.3.1 Description

    Private memory, is defined as memory allocated for a process which cannot be shared by other processes. This memory is more expensive than shared memory when multiple such processes execute on a machine. Private memory in (traditional) unmanaged dlls usually constitutes of C++ statics and is of the order of 5% of the total working set of the dll.

提交回复
热议问题