4 ms·
Is that always true? If a long-living process (like Emacs in that blog post) at some point temporarily uses a lot of more, is it a good idea it keeps hold of th
by roelschroeven 7y ago
Is that always true? If a long-living process (like Emacs in that blog post) at some point temporarily uses a lot of more, is it a good idea it keeps hold of that amount of memory forever, even if they don't have any use for it anymore?
It could be, but it's counter-intuitive to me that processes keeping unused memory in use is better for the system.
- BubRoss 7y agoNo, it's total nonsense of course. If you imagine a web browser with lots of tabs open, if someone closes lots of tabs they might be doing it specifically to free up memory. Even going over physical memory is not a death sentence anymore because of fast SSDs being used for virtual memory. Because that is slower however, freeing up memory will still speed everything up, even if the maximum memory used needs to go over physical memory. The OS also caches memory mapped pages of files, so memory used means more disk IO from that standpoint as well. Even disregarding all of that, heaps get fragmented, and if many virtual memory allocations can be given back to the OS, the next time more memory is needed it will be allocated in large, 'virtually contiguous' chunks that start out without fragmentation.
- ncmncm 7y ago> Is that always true? "Usually" has a well-defined meaning, readily available from your nearest English dictionary, that is rather opposite to "always". If a pause in execution of other threads is tolerable, then taking it could be the right choice. But taking it every time is usually (that word again) the wrong choice. So, identify times where it is warranted, and do it just at those times.