News for hackers. Stuff that matters.
Re:Firefox 73 by magicalhippo on Tuesday February 11, 2020 @06:46PM (#22304221)
In addition to the MEM_RESET, MEM_RESET_UNDO mentioned, there's also OfferVirtualMemory[1], ReclaimVirtualMemory[2] to let the system potentially use the memory if it needs it.

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...

Re:Firefox 73 by rhn_mk1 on Wednesday February 12, 2020 @03:21AM (#22306950)
That seems to be something different; instead of getting the memory when some other application needs it, the OS receives the memory when the application (browser) doesn't need it any longer, so it can't be used for caching.

This actually looks exactly like the malloc/free use case.

Re:Firefox 73 by magicalhippo on Wednesday February 12, 2020 @05:18AM (#22307583)
How can't it be used for caching? Say you decode an image, then offer the memory backed by it to the OS. If you need to access the image data again you try to reclaim the memory, if it fails it's a cache miss.
Re:Firefox 73 by rhn_mk1 on Wednesday February 12, 2020 @04:04PM (#22312793)
You're right, the missing info I didn't notice was the return value.