I had 12.04 without problems, but since I upgraded to 14.04, I'm noting the system is very slow for UI tasks, and when I get to work the next day (computer stays on), and I type the passwords, it takes like 1 minute to log in.

However, top or htop doesn't show significant CPU usage. It is so slow that writing this post and right clicking in a word for corrector to work takes 10 secs to show the menu and mouse pointer teleports when I move it.

Now that I have closed VirtualBox is much better so I think the problem may come from there.

VirtualBox is 4.3.10_ubuntu and the VM is Win7 with "Use 3d acceleration" marked.

But since htop is not showing considerable CPU usage, what do you think could be the cause of this?

enter image description here


VirtualBox is using far too much RAM for your system, and you are swapping constantly. I retouched the image to make it visible:

a lot of memoey used

VirtualBox have a virtual memory requirement that are almost the same size of your physical RAM.

How much memory have you dedicated to the virtual machine? In my experience, everything that goes more than 1/3 of your total physical RAM is asking for troubles and slowdowns.

The java process under it could be also part of the problem (it's at 2.8G!) --- chances are that VirtualBox and that process are competing for RAM and livelock together swapping like crazy.

More detailed: that the Virtual Size is the memory the process has "mapped", that is, the memory it thinks it has --- only part of that is really in RAM at any moment, and that part is the one marked with RES (for resident). If the program tries to access memory which is in its virtual pool but not in RAM, and the memory is full, some other memory must be swapped out to make place for the new one. So if you have two process with a big difference between Virtual and Resident memory, chances are that the two are swapping out the other one at every scheduling switch --- making the system slow to a crawl --- swap memory can be millions of time slower than RAM.

The fact that it happens after a long period of inactivity is probably due the fact that the system has settled on a partition of the RAM among the process that more or less satisfy all of them for that workload. When you change the kind of workload again, different part of the programs are loaded, and the swap frenzy starts. Chances are that if you wait the necessary time (could be hours!) the system will more or less find another decent equilibrium; it's the transitory which is bad.

About your case:

With 4G of RAM, having a virtual machine of 1.5G is ok, if it's the only memory hungry process in the system. Probably that one and the IDE are too much.

Dirty (and dangerous) Trick

To have back a responsive system, the faster way I know is to force swap off; but this is quite dangerous sometime. The basic idea is to do a

sudo swapoff -a

wait for finishing...

sudo swapon -a

This will try to put all the memory back in RAM. If it can't, processes will be unmercifully killed along the way. To avoid the death of some innocent and important system process(1) the best way is to try to close the memory-hog before doing the swapoff.

(1) the OOM (out-of-memory) killer of the kernel will try to kill the correct processes, but it's not failproof.

  • I have 4GB of RAM and Win 7 has 1.5 to use, the java process is an IDE, PHPStorm. There says 2.8GB but what is it? I have 1.5GB of swap being used, so what is this VIRT thing? – JorgeeFG Oct 21 '14 at 12:06
  • See for example unix.stackexchange.com/a/35138/52205. – Rmano Oct 21 '14 at 12:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.