Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

No, unused memory should always be used as cache if it has no other use at the moment. It's wasted otherwise.


I think a lot of this comes down to semantics confusion for most people. Intuitively one would assume "unused" memory would be the inverse of "used" memory, with not everyone thinking what even counts as "used" or "unused" in the first place. In reality on macOS/Windows/Linux "used" memory is counted as a specific type of usage (e.g. processes/system/hardware), cached things are counted as cached, and there are multiple ways to refer to which "unused" portion you mean (e.g. free vs available) as well as anywhere between a half to several dozen ultra specific terms to break things up further with which probably don't matter in context.

Once you clear the semantics hurdle it's surprising how much people are in agreement that "used" should be optimised, "cached" should fill as much else as possible, and often having large amounts of "free" is generally a waste. The only remaining debate tends to center on how much cache really matters with a fast disk and what percentile of workload burst should you worry about how much "free" you have left after.


Is that generally how unused memory is used, and will this kind of "cache" be released if another application truly needs it to load actually vital things?


Yes, that’s the main job of the OS memory management.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: