4 ms·
You have to give an app whatever memory it asks for, or it will crash. If it doesn't use that memory, the OS will swap it to disk. Apps don't generally change
by extension 15y ago
You have to give an app whatever memory it asks for, or it will crash. If it doesn't use that memory, the OS will swap it to disk.
Apps don't generally change their behavior based on the size of physical RAM, but maybe Chrome does this as a very advanced optimization.
- mgkimsal 15y agoWe should be able to tell the OS - "don't give app X more than 300meg" and let the OS handle swapping directly, regardless of what the actual RAM is.
- jiggy2011 15y agoHow would you know how much RAM is going to be needed by a process? Let's say you load up you video editing program, maybe it only needs 512MB of memory to fit the whole program into memory, now what happens when you load in LOTR directors cut? Especially if you aren't running any other large programs, would it still make sense to restrict it to 300MB (or 1GB , or 2GB etc)? I think it's safer to assume that OS developers know what they are doing and can be trusted to handle memory contention issues better than most of us can. As an aside some programs (like redis , memcached etc) do allow you to restrict the amount of RAM which they use but this is because they are explicitly greedy with memory and are probably used by people with enough skills to measure actual usage and tune accordingly.
- mgkimsal 15y ago"How would you know how much RAM is going to be needed by a process?" I don't necessarily. I just know how much RAM I want to be able to give it. I'd love to be able to test apps in lower-RAM scenarios. Just because I've got 8g or 16g doesn't mean everyone does, but I have no way to test what that experience will be like. Additionally, I may have two processes that are both rather RAM hungry that I need to run. Give me the option of constraining one of them so that I can give RAM priority to one or the other rather than "oh, well the OS people are smarter than me, so I guess I have to trust that app 1 will get RAM priority over app 2, or they'll just both have to be equal".
- jiggy2011 15y agoIf you want to artificially constrain memory in order to test performance in low memory systems then this is a different use case entirely and I'd be surprised if there is not software available to do this for you. Although you should bear in mind that computers with less memory probably have less everything else (including slower memory busses) so your best bet is to actually find a slower computer and test with that. Most OSes will let you prioritize other processes over others (e.g Linux has "nice"), whether this is just for CPU preemption priority or whether it does other resources as well I'm not sure. However I think most swapping systems will try and keep the most frequently used pages in RAM , so if one process has preemption priority over another this problem would solve itself as it's memory area would just get accessed more often. Again this is kind of finger in the air stuff so anyone more familiar with OS design should feel free to correct me.