Open Bug 381950 Opened 17 years ago Updated 2 years ago

Need a way to declare MinimumWorkingSetSize and MaximumWorkingSetSize when MS Windows NT and later, to stop repeated opening of "Memory Leak!" bug merely by "Mem Usage" column value of MS Win's Task Manager

Categories

(Core :: General, enhancement)

x86
Windows XP
enhancement

Tracking

()

People

(Reporter: World, Unassigned)

References

Details

As I wrote in Bug 320915 Comment #46, if config.trim_on_minimize=true is defaulted, a flood of complaints of Bug 76831 will occur again. And if config.trim_on_minimize=false is defaulted(currently set by Fx/Tb 1.5 and 2.x), bugs such as Bug 320915, Bug 378077 will be repeatedly opened.
When MS Win, I think a way to declare MinimumWorkingSetSize and MaximumWorkingSetSize is required.
See http://msdn2.microsoft.com/en-us/library/ms686234.aspx for SetProcessWorkingSetSize, MinimumWorkingSetSize and MaximumWorkingSetSize.

Note: Author of following document says MS Win's page management is "Page trimming", and uses term of "Page stealing" for other many operating systems.
  "Windows NT page replacement policies"
  http://www.demandtech.com/Resources/Papers/WinMemMgmt.pdf
Blocks: mlk1.8, 378077
Severity: normal → enhancement
Component: Widget: Win32 → General
QA Contact: win32 → general
Just an idea:
1. Introduce .Win_WS_min/mid/max prefs (integer).
When minus value, treat it as value (SIZE_T)-1 (0xFF...FF).
If greater than physical memory size, treat it as 50%*(physical memory size), with issuing warning message.
2. Declare MinimumWorkingSetSize=Win_WS_min and MaximumWorkingSetSize=Win_WS_max on start up.
3. When config.trim_on_minimize=true, declare MaximumWorkingSetSize=Win_WS_mid when minimized, and change back to MaximumWorkingSetSize=Win_WS_max on re-activation.
Another idea to avoid exhaust of real memory on MS Win NT or later, without heavily slowness when resume from suspend, with utilizing current & simple config.trim_on_minimize=true mechanism, without Maximum/MinimumWorkingSetSize requests. 

When Firefox/Thunderbird/Semonkey window becomes not_the_top_most window, or when detects idle time for several soconds, issue similar request to one when config.trim_on_minimize=true & window is minimized.
And after a few seconds, return from status of config.trim_on_minimize=true to config.trim_on_minimize=false internally.
Any such enhancements will not be implemented on the 1.8 branch, therefore clearing dependency on Gecko 1.8 bug.
No longer blocks: mlk1.8
Summary: Need a way to declare MinimumWorkingSetSize and MaximumWorkingSetSize when MS Windows NT and later → Need a way to declare MinimumWorkingSetSize and MaximumWorkingSetSize when MS Windows NT and later, to stop repeated opening of "Memory Leak!" bug merely by "Mem Usage" column value of MS Win's Task Manager
FYI.

To know value near to really needed Working Set size on MS Win, next is
required.
(1) config.trim_on_minimize=true and restart
(2) Check really needed/frequently referred real memory size. 
(2-1) Use Firefox ordinaly for a while,
      check "Mem Usage" value and "Virtual Memory Size" value.
(2-2) Minimize Firfox, and wait for a while,
      check "Mem Usage" value and "Virtual Memory Size" value.
(2-3) Retuen to normal window size, and do some operations until no delay
      in responding is observed,
      check "Mem Usage" value and "Virtual Memory Size" value.
(3) Repeat (2) many times.
    Avarage size of step (2-3) is rough really-required "Working Set Size".

Average size of step (2-3) is evidence that Mozilla requires large real memory to keep acceptable response time.
Delta of Virtual Memory Size value and average value of (2-3) is an evidence of
inefficient use of virtual memory or Magnate Programming.
Infinite increase of Virtual Memory Size value is an evidence of memory leak in many cases.
FYi.
Wiki page for "Paging".
> http://en.wikipedia.org/wiki/Paging
A document pointed in the Wiki page relevant to "page pool management" of MS Win XP.
> http://support.microsoft.com/?id=312362
Accotding to the document, MS Win-XP is lazy in expensive "page trimming" work;
  By default, starts "page trimming" when 80% of page pool is used.
To avoid problem due to delay in the expensive "page trimming", this document inducts a way to change it to "when 60% of page pool is used" or "when 40% of page pool is used".
Actual setting may be changed in Win Vista, Win 7, Win 8, but is still conceptually same, because essential design of "page trimming in MS Windows" is not largely changed from MS Windows NT/2K/XP.
FYI.
A text book relevant to "Microsoft Windows Internals" which found by Google search.
> http://flylib.com/books/en/4.491.1.1/1/
  Table of contents of "Microsoft Windows Internals".
  Chapter 7. in it is "Chapter 7. Memory Management"
> http://flylib.com/books/en/4.491.1.57/1/
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.