Reputation: 7197
Is there a way to send the memory swapped, back again to the principal memory?
EDIT: I had a process that I ran and eated all memory, so now, each time I use another app, it has something in swap, so it takes time to reload to memory. Now the consuming memory process has stopped, I want to force to have all the things in memory again. So I will wait only one time to have the things that are in swap to memory again, and not each time that I reuse an opened app.
Upvotes: 0
Views: 1589
Reputation: 61389
Not directly; moreover, usually you don't want to, as often what is swapped is the part that is no longer needed (initialization code). The only way to force the issue is to ask the kernel to disable the swap area, and even that is not immediate.
Upvotes: 1
Reputation: 26322
The kernel will automatically and transparently swap that data back into RAM when it's required.
You can avoid getting swapped out using mlock()
or mlockall()
, but you probably shouldn't do that. If your app ends up getting swapped out it might be using too much memory, or there could be too little memory in the machine, or too many running processes. None of those problems will be improved by your app using mlock()
.
Upvotes: 0