News for hackers. Stuff that matters.
Re:Improving Firefox stability with this one weird trick by pmoriarty on Tuesday November 22, 2022 @09:54AM (#33706451)
Why don't more applications use this "weird trick" of just checking to see if memory allocation succeeded and waiting and retrying if it didn't, instead of unceremoniously crashing?

It's not like this hasn't been possible to do for many decades already.

Re:Improving Firefox stability with this one weird trick by avian on Tuesday November 22, 2022 @09:59AM (#33706513)
Even better question is, if it is this simple, why didn't Microsoft implement their malloc or whatever like this in the first case. If the OS needs to resize the page file, why don't they just delay the return of the function until that is done?

I'm guessing the answer is something along the lines of "it makes applications freeze for <amount of time> and users don't like that".

Re:Improving Firefox stability with this one weird trick by jraph on Tuesday November 22, 2022 @10:17AM (#33706675)
Sure, they prefer their applications to just crash :-)

Bu yes, the problem is probably not totally simple. adding delay in malloc while application might expect an immediate return could cause bugs. But swapping is a thing anyway and introduces delays so I don't know why they would not do this.

Re:Improving Firefox stability with this one weird trick by 323 on Tuesday November 22, 2022 @10:47AM (#33706992)
Because something still crashes on the user computer.

Also the tragedy of the commons, if everybody does this we are back to square one.

The actual solution is for the user to buy more memory, use a different app or change the workflow.

Re:Improving Firefox stability with this one weird trick by pas on Tuesday November 22, 2022 @12:48PM (#33708583)
Or Firefox to say to the user to buy more RAM, close other apps, etc.

Also Windows should step in and say that this application is consuming almos all of the remaining memory, close others, or this or buy more RAM.

Re:Improving Firefox stability with this one weird trick by 323 on Tuesday November 22, 2022 @02:37PM (#33710233)
> Also Windows should step in and say that this application is consuming almos all of the remaining memory

This is much more complicated that it appears, because the user could be intentionally doing that - if you have little memory (8 GB), you are sort of always almost out of it, if you have a lot but you are using professional apps like Photoshop, video editing, or doing machine learning with large datasets.

I'm sure that the reason Windows doesn't do this is because they couldn't figure out a good way to warn which is also not annoying.

There are some Windows warnings, I've seen them, but they only appear when the situation is so dire the computer is about to blue screen.

Re:Improving Firefox stability with this one weird trick by pas on Tuesday November 22, 2022 @02:52PM (#33710470)
I disabled the swap in Windows, because I have 32G RAM (and why put unnecessary wear on the SSD). And now it runs out of memory while half the RAM is empty.

A marvelous operating system.

But yeah, at least I saw the warning fast, with the swap file it first came to a sudden halt, and after a lot of time it might have shown the alert.

Re:Improving Firefox stability with this one weird trick by astrange on Wednesday November 23, 2022 @12:47AM (#33715688)
Turning off swap will lead to running out of memory earlier than you’d think because different tasks can allocate a lot instantaneously - you just need a few of them to line up and try allocating a lot at once.

I don’t see how you can realistically operate a computer this way unless you control all the software on it, or you enjoy buying way more RAM than you need.

(Also swap isn’t the only alternative to allocating memory - there’s also purgeable allocations and memory compression.)

Re:Improving Firefox stability with this one weird trick by adql on Tuesday November 22, 2022 @10:58AM (#33707132)
Well, you'd need to wrap every memory allocation with that wrapper.