The memory metrics are inconsistent and poorly defined.
These functions are Windows-specific and don't mean anything on non-Windows platforms. Some of them are defined [with other meanings] on different platforms. Some of them just return 0. The problem is that consumers of these APIs have *expectations* about what these functions mean, and those expectations are almost always cross-platform.
The memory-infra service is the sole vendor of cross-platform-consistent memory metrics [in the form of "memory footprint"].
"""
// Returns the current space allocated for the pagefile, in bytes (these pages
// may or may not be in memory). On Linux, this returns the total virtual
// memory size.
size_t GetPagefileUsage() const;
// Returns the peak space allocated for the pagefile, in bytes.
size_t GetPeakPagefileUsage() const;
// Returns the current working set size, in bytes. On Linux, this returns
// the resident set size.
size_t GetWorkingSetSize() const;
// Returns the peak working set size, in bytes.
size_t GetPeakWorkingSetSize() const;
// Returns private and sharedusage, in bytes. Private bytes is the amount of
// memory currently allocated to a process that cannot be shared. Returns
// false on platform specific error conditions. Note: |private_bytes|
// returns 0 on unsupported OSes: prior to XP SP2.
bool GetMemoryBytes(size_t* private_bytes, size_t* shared_bytes) const;
// Fills a CommittedKBytes with both resident and paged
// memory usage as per definition of CommittedBytes.
void GetCommittedKBytes(CommittedKBytes* usage) const;
// Fills a WorkingSetKBytes containing resident private and shared memory
// usage in bytes, as per definition of WorkingSetBytes. Note that this
// function is somewhat expensive on Windows (a few ms per process).
bool GetWorkingSetKBytes(WorkingSetKBytes* ws_usage) const;
// Computes pss (proportional set size) of a process. Note that this
// function is somewhat expensive on Windows (a few ms per process).
bool GetProportionalSetSizeBytes(uint64_t* pss_bytes) const;
"""
Comment 1 by erikc...@chromium.org
, Mar 6 2018Owner: erikc...@chromium.org
Status: Assigned (was: Untriaged)