3 ms·
Most computing environments don't have a user to speak of, and the correct response of an application to an out of memory error could range from doing nothing t
by nitrogen 13y ago
Most computing environments don't have a user to speak of, and the correct response of an application to an out of memory error could range from doing nothing to sounding an alarm.
As a user, I find it incredibly frustrating when my old but indispensable music software runs out of address space (I have plenty of RAM) and, instead of canceling the current operation (e.g. processing some large segment of audio), just dies with a string of cryptic error dialogs. The best thing for the user in this case is to hobble along without allocating more memory, not to fail catastrophically by assuming that memory allocation always works.
Swap is not a good solution because when there's enough swap to handle significant memory overuse, the system becomes unresponsive to user input since the latency and throughput to swap are significantly slower than RAM.
- majika 13y agoI think most computing environments do have a user of, if you consider a "user" to be something that be notified and can act on such notifications (e.g. to close applications). Your music software's problem seems to be a bad algorithm - not that it doesn't check the return values of the `*alloc` functions.Aas you say, it should be able to process the audio in constant space. While I assume that I can always acquire memory, I do still care about the space-efficiency of my software. I must admit I've never seen my system depending on swap, so I don't know how bad it is. But, if you have 1GB of on-RAM memory already allocated, wouldn't it only be new processes that are slow? Also, I'd again point out that if you don't like swap, you don't have to have one.
- hvidgaard 13y ago> if you have 1GB of on-RAM memory already allocated, wouldn't it only be new processes that are slow? No - the memory sub system, will swap out pages based on usage and some other parameters. A new application would most likely result in already running applications least used pages being swapped out.
- nitrogen 13y agoI must admit I've never seen my system depending on swap, so I don't know how bad it is. Just for fun, try deliberately creating a swap storm some time. Then try to recover from it :-). Do this on a system that doesn't have other users.