3 ms·
You need to push things out of swap back into memory. I usually just swapoff and swapon, but I'm sure there's a better way.
by pstrateman 8y ago
You need to push things out of swap back into memory.
I usually just swapoff and swapon, but I'm sure there's a better way.
- gnulinux 8y agoThe problem is not just swap. OS caches A LOT of things in memory, and when it cannot do that, it simply deletes the cache. At that point it's not possible to build the cache again, unless it specifically performs unnecessary operations to build an inaccurate cache. Same goes for mmapped files. This is not an easy problem. Once you lose your cache, there is no way to get it back. At least if swap is enabled, it can temporarily store its cache. A different but similar problem is "thrashing" where vmem is overloaded so everything page faults. Simply doing swapoff swapon won't recover from this. The real recovery from this is cleaning virtual mem, and let your program run for a while so that some cache is collected. This may take seconds to hours, depending on your application and vmem size.