Liste des Groupes | Revenir à cl c |
Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:The server runs out of memory once. Sometimes yes, it's "these things happen, just get it back up". But more often. it's "Can't have that happening again. Shut something else down we don;t really need, or maybe buy an extra 2GB. Only ten dollars after all."On 12/03/2024 01:20, Keith Thompson wrote:[...]Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:Are you relying in a person sitting in front of the computer andIf I withdraw 20 pounds from my bank, I'll bet you that 20 poundsNo, it's an analogy. You run lots of apps gobbling lots of memory, and
that the bank still checks whether it has the money. I'd rather
write correct code than code that almost certainly happens to work.
Sure, strdup() is unlikely to fail-- but I'm going to check the
result.
>And how often do banks fail, actually, and how often does governmentThe government isn't going to intervene when your laptop is running
take action when it's heading that way, but nowhere near failing yet?
low on memory.
>
maybe a program won't launch or thngs start to slow or a warning comes
up, and you realise that soon the program of interest might run out of
memory, and so you shut other things down so that that doesn't happen.
And so it's pretty rare to actually run out of memory unless the
program isn't correct and there is a leak.
noticing that memory is running low? The vast majority of software
doesn't have someone watching it.
I agree that an allocation failure in strdup() is unlikely. Are youIf it's genuinely the case that an electrical faiure is more likely, is there a really a point? But for my code, the test would go in, because it usually is intended to last for a very long time, and small memory machines might come back into fashion (eg smaller but very cheap and very fast, or maybe it will be used in an embedded system)
suggesting that that means you needn't bother checking the result?
Les messages affichés proviennent d'usenet.