Was the 12GB with another RAM-intensive app running? Or just Firefox by itself.
Was the 12GB with another RAM-intensive app running? Or just Firefox by itself.
Unlike MEM_RESET, this allows you to prioritize the memory you offer, as well as provides some extra safeguards it seems.
No idea if Firefox uses this or MEM_RESET.
[1]: https://docs.microsoft.com/en-us/windows/win32/api/memoryapi...
[2]: https://docs.microsoft.com/en-us/windows/win32/api/memoryapi...
This actually looks exactly like the malloc/free use case.
Browser > OK we can purge these tabs first
is how it should work. If the first step doesnt happen, its not clear if the second one should execute by itself. Id be much more concerned about background CPU usage. Eats battery, and actually slows the computer down.
That all said, its pretty clear that browsers are leaking RAM sometimes. I remember bed bath and beyond using 9 or 12GB of ram the other month.
That's not how it works. Browser might monitor free system memory actively and release memory if the system runs low, but at least Firefox doesn't do that.
There is no mechanism (in Windows, Linux) that allows the OS to notify applications of memory pressure or that allows the application to tell the OS that some allocations can be thrown out if need be. (Windows has a mechanism - MEM_RESET - that only works with paged out allocations)
Edit: Windows 10 (8?) actually expands on MEM_RESET with Offer/ReclaimVirtualMemory, but I kinda doubt browsers use this, because these have similar semantics to MEM_RESET (except they seem to work without paging, which is good). For an application that wants to cache not-well-defined amounts of data itself these might be very useful though, because you can make the data structure simple enough that it works with these.
There are mechanisms for both of these in up-to-date Linux - pressure stall information and volatile ranges, respectively.
If all of my memory is "in use" but half of it is cached file pages, should Firefox compact its heap and evict cached images? What if all of my memory is spoken for but a bunch of it isn't actually committed, due to overcommit?
Browser> So this memory here, I don't really care if you swipe it in the future.
(later)
OS> Yum yum
(later)
Browser> Oh, that buffer is empty, let me fill it again.
Firefox uses it, IIRC, for decoded image buffers.
https://searchfox.org/mozilla-central/source/memory/volatile...