Closed Bug 1786860 Opened 2 years ago Closed 2 years ago

Use task_info's phys_footprint field to measure MEMORY_TOTAL on MacOS

Categories

(Core :: XPCOM, task)

All
macOS
task

Tracking

()

RESOLVED FIXED
107 Branch
Tracking Status
firefox107 --- fixed

People

(Reporter: pbone, Assigned: pbone)

References

(Depends on 1 open bug)

Details

Attachments

(3 files)

This API exists since 10.11 (Bug 1779138 Comment 12) and may be more in-line with what people expect, certaily it matches what's reported by the MacOS activity monitor. Should we use it to measure our "resident-fast" memory in about:memory and within telemetry?

See for example: https://phabricator.services.mozilla.com/D153569

Assignee: nobody → pbone
Status: NEW → ASSIGNED
Summary: Should we use task_info's phys_footprint field to measure "resident fast" memory on MacOS? → Use task_info's phys_footprint field to measure MEMORY_TOTAL on MacOS

I have checked, from testing and the xnu sources. I'm almost certain that phys_footprint Includes shared memory without attempting to factor it by how many things refer to it. Therefore if we add all the phys_memory stats for each firefox process will will have an over-estimate of Firefox's total memory use due to counting shared-memory regions multiple times. On the other hand we used to add up the unique memory which would lead to an under estimate.

I'm not sure there's a better way to do this without introducing performance problems like Bug 1779138, since that requires actually inspecting the regions ourselves which that can have performance problems on MacOS (but might be acceptable on other OSs). I guess, until something better comes along, phys_footprint is the best we've got.

I'm going to move forward with this and propose my changes. maybe something is better than nothing for MEMORY_TOTAL, at least we'll see trends.

Attachment #9291946 - Attachment description: Bug 1786860 - use TASK_VM_INFO for the resident unique memory value on Mac, r=kmag. → Bug 1786860 - Use TASK_VM_INFO on Mac to provide a new about:memory measurement r=kmag
Pushed by pbone@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/66f6ca5e2b53
Use TASK_VM_INFO on Mac to provide a new about:memory measurement r=kmag
https://hg.mozilla.org/integration/autoland/rev/a9c781f95f8f
Add a comment about ResidentUnique's performance on MacOS r=kmag
https://hg.mozilla.org/integration/autoland/rev/83b0b0acaa0a
Use phys_footprint on MacOS to provide MEMORY_TOTAL r=kmag
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 107 Branch
Blocks: 1792500
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: