7 ms·
Ok, but how to interpret the results? If the memory is not used, it is a problem that Chrome takes up so much of it?
by greyman 17y ago
Ok, but how to interpret the results? If the memory is not used, it is a problem that Chrome takes up so much of it?
- ori_b 17y agoThe problem is that the memory is used by other programs when I want to start them up. Don't get me wrong, caches are great. However, it's one thing for the OS to cache stuff, because it can easily drop caches when memory pressure rises. Userspace software in current systems have no good way of knowing the memory pressure, and no good way of responding to it by dropping caches to free up memory. (yes, an API for "this memory is a droppable-at-any-time cache" would be nice in OSes, but it doesn't exist at the moment, and getting one that's easy to use would be hard). More or less, that means that software that uses more memory in userspace causes swapping and lame performance. And honestly, there is no good reason for a browser to easily be the most resource intensive program on my system. Even games tend to be far lighter than browsers.
- dkarl 17y agoan API for "this memory is a droppable-at-any-time cache" would be nice in OSes, but it doesn't exist at the moment Naive question: would this be any better than letting applications provide swapping hints to the OS? And is that any better than just letting the OS swap based on usage?
- ori_b 17y agoYes, to a certain degree. The problem is that it would be cheaper to, say, drop a decoded version of a JPEG and re-decode it, instead of having it get swapped out. In fact, I suspect that for large images, it would be cheaper to re-read the compressed jpeg and decompress it than to read back a larger swapped out decompressed version, just because hitting the disk is slow, and swap tends to get fragmented because it's usually written a few pages at a time. Swap hints probably aren't really worth the effort, although I haven't benchmarked it. The idea behind caches is to avoid doing expensive operations repeatedly, and hitting swap is about as expensive as an operation can get.
- ori_b 17y agoOh, another big problem is that you need to actually write the data you're swapping out to disk. You can't just drop it on the floor whenever memory pressure is high; You have to wait for the disk so spin up, seek, write, and so on. What you really want is to be able to tell the OS "I don't care if this data goes away. If you need space, don't bother taking time to save it, I can regenerate it quickly."