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

malloc will take away from the disk cache.

Fwiw without swap there isn't really any paging in or out (yes mmapped files technically still can but they are basically a special cased type of swap) so your question is hard to parse in this context. The disk cache is all about using unallocated memory and an allocation will reduce it. Paging is irrelevant here.

Btw you should always enable swap. Without it you force all unused but allocated memory to live on physical RAM. Why would you want to do this? There's absolutely no benchmarks that show better performance with no swap. In fact it's almost always the opposite. Add some swap. Enjoy the performance boost!

https://haydenjames.io/linux-performance-almost-always-add-s...



I would say that for any modern unix implementation mmaped pages are quite significant, as all the read-only copies of libc code, other shared libraries and various mmaped data files (iconv tables, locales, terminfo, gettext catalogs…) are not exactly small.


Which is why disabling swap in the hopes of preventing the system grinding to a halt on out-of-memory doesn't work, and actually makes things worse.




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

Search: