-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Decommit unused virtual memory unless overcommit is enabled #255
Comments
|
It definitely shouldn't stop doing lazy free by default, as performance matters more than perception of memory usage (there's no change to actual memory usage). |
Using |
This was #206. I don't have a good way to test a Windows-specific decommit patch, but I think the decommit code works correctly as of 1f27abc, so it would probably be simple to develop a patch. I just committed 03bf5b6 so that new chunks can be decommitted (still testing more thoroughly). As far as I know, the only necessary additional change is to implement Windows-specific decommit/commit code in We're in agreement that nothing needs to change on OS X, right? |
@jasone: You could |
@thestinger, you mean something like the code I just disabled? |
I mean having all three of these functions across platforms:
It would use Toggling on |
@jasone: Yeah, that looks like it. |
Cool. In the future I think we should detect whether overcommit is active and do the right thing if not, but right now I'm just trying to get 4.0.0 released. |
@jasone: The one other change that'd be useful is passing There's no rush to get this worked out though since it has always been an issue. |
FWIW, enabling the pages_commit/decommit code has some serious performance impact on the various Firefox benchmarks. |
Would it be possible to add a "high watermark" parameter in order to limit the amount of unused pages? Or create some sort of "garbage collection" function? The amount of mapped pages just keeps on growing. Peak usage: In the beginning the mapped memory does go down: But after a while: |
It can only unmap chunks (4M naturally aligned regions), so they need to be entirely empty for that to happen. It's not really relevant on 64-bit. Virtual memory is a per-process resource and there's plenty of it to spare. Purging happens in multiples of the page size so it's much finer grained. This issue was about supporting Windows-style decommit where the memory is immediately dropped and marked as unusable rather than the significantly more efficient lazy purging (MADV_FREE / MEM_RESET). The only reasons to fully decommit are to make memory usage easier to measure (it doesn't actually drop the memory usage) and to reduce the accountable memory for systems without overcommit (if it's usable and writeable, it counts towards the memory limit, but simply being mapped does not). |
The mapped memory will definitely tend to increase over time due to fragmentation. It's only a measurement of virtual memory though. It's not a measurement of memory usage. Even if you're worried about virtual memory exhaustion on 32-bit, the amount of mapped memory isn't all that useful since the location of the mappings matters even more due to fragmentation of the address space. The fragmentation is lowest if it never unmaps but then it never drops from the peak usage level (not an issue in normal programs). |
OK clear. BTW the new feature does seem to work, at least now the "Working set" is better reflecting the "active" memory (before that it was the same as "Commit size"). But this version (MEM_DECOMMIT) seems on average about 8% slower than before (with MEM_RESET). |
It does perform calls on ranges as large as possible. Using |
Disagree with the last statement. The limit can be (and is for us) quite well-defined, as our policy enforces a fixed page file of 60% of the amount of RAM. That results in an OOM when I just keep on doing |
Linux supports http://kernelnewbies.org/Linux_4.5#head-42578a3e087d5bcc2940954a38ce794fe2cd642c |
This issue is a subset of #193; closing. |
This is something that I either failed to report or can't find anymore, but I stumbled upon this while going through the jemalloc3-related issues on bugzilla.mozilla.org.
The symptoms are that memory usage is not shrinking after tabs are closed in Firefox. Here is what I wrote back then, after investigating the issue on Windows:
Coincidentally, all the current work around generalized commit/decommit hooks can probably help us work around the issue.
Following is the crude patch I wrote back then:
The text was updated successfully, but these errors were encountered: