Currently, we call VMPI_getPrivateResidentPageCount() from GCHeap::ExpandHeap(), to maintain the maxPrivateMemory field. Some implementations of this VMPI call are slow; on Windows, we attempt walk the entire address space (!) and call VirtualQuery on each section. (1) Is it possible to have GCHeap / VMPI maintain the private resident page count itself, or must we query the OS every time? (2) can we call this less often?
Created attachment 400590 [details] [diff] [review] Patch #1 -- conditionalize maxPrivateMemory This is a bit of a hack, but the maxPrivateMemory field is only needed when MMGC_POLICY_PROFILING is defined (which it usually isn't). Commenting this out removes the need for the VMPI call in expandHeap -- in a testcase that is ExpandHeap-happy, it improves performance by ~5% (on my Vista64 machine).
Comment on attachment 400590 [details] [diff] [review] Patch #1 -- conditionalize maxPrivateMemory I approve this for the sake of expediency, but the change is in some sense incorrect. The API was added to GCHeap to allow the Flash Player to read consistent data for memory use, something previous APIs did not allow. See eg comment 15 on bug #501318, although it's not very informative. Anyhow the API landed without changes to the player to make use of it, IIRC, so this is probably OK for now. (Be aware that MMGC_POLICY_PROFILING is enabled by default in release builds of the avm shell. This is by design, but it's debatable whether it's smart.)
Attachment #400590 - Flags: superreview?(lhansen) → superreview+
(In reply to comment #2) > (From update of attachment 400590 [details] [diff] [review]) > I approve this for the sake of expediency, but the change is in some sense > incorrect. Tommy suggested making this a runtime-configurable option (via a GCHeapConfig var)... would that change be preferable? Also, is it possible to track this number directly, rather than having to ask the OS?
Comment on attachment 400590 [details] [diff] [review] Patch #1 -- conditionalize maxPrivateMemory pushed as changeset: 2504:7419870a4407
Deferring, as the cost is not a problem if it's not called much.
Priority: P5 → --
Summary: VMPI_getPrivateResidentPageCount is expensive → VMPI_getPrivateResidentPageCount is expensive - can we optimize?
Target Milestone: flash10.2 → Future
You need to log in before you can comment on or make changes to this bug.