Open programs take forever to reload after another program used-up all the memory

1

I have the following phenomena: I have 4GB RAM, and sometimes I use a program (program A) which uses up all the available memory, say 3.9GB. If there are more open programs, then their memory is probably saved to disk and on taskman I see they now use almost no memory. Once I close program A, the memory is freed instantly (I see it on the taskman), and I expect the rest of the programs to load back to memory fast. But unfortunately, it takes them several long minutes (up to 5-10 minutes) until they load up properly.

Example: I open program A while Firefox is minimized on the background. Since Firefox usually uses about 500MB, and A needs my entire memory, Firefox now uses about 10-20MB and I obviously can't open it (technically I can, but it will take forever to restore it). Now I close program A and watch Firefox slowly loading back into memory, and until it reaches 400-450MB it remains "stuck".

What causes the memory loading to be this slow? is it the memory speed? maybe hard disk speed? maybe I can control it via the OS preferences (I use win7)?

Thanks.

yoki

Posted 2014-09-11T07:21:25.773

Reputation: 177

Answers

1

The memory of the applications that are not in use has been paged out, meaning it has been written to disk and was removed from RAM. Even if you free up RAM, the memory of the applications is still on the disk and not in RAM. Reading 500 MB from a very slow disk can take a while. Longer if an antivirus manages to mess everything up. This goes significantly faster if the pagefile/swapfile is located on a fast SSD. The process can also potentially be sped up by creating a larger page file, to reduce fragmentation. Some applications also do their own memory management and try to reduce their footprint when memory becomes tight, which may or may not increase or decrease the size of the problem (ie they try to help but may screw up while doing so).

The memory speed is irrelevant, because the slowest RAM is orders of magnitude faster than the fastest harddisk (assumining real world consumer computers).

Peter

Posted 2014-09-11T07:21:25.773

Reputation: 4 199

Thanks! So the 'bottleneck' here is the hard drive speed? Although I also suspect the AV, I have some 'enterprise AV' that is known to make things considerably slower, maybe it is the culprit. – yoki – 2014-09-11T07:58:21.567

1The initial bottleneck is RAM. Getting a couple GB more RAM (32, or maybe 64) will disable the issue altogether (that's why machines with RAM soldered on the board are annoying). Now, if you can't get rid of swapping, you have to make it faster - in that case going for a faster disk will help. There is a lot of writing on the SSD involved, but given that the smallest SSDs nowadays are 64 GB and wear leveling works well, this shouldn't affect the lifetime of the SSD that much. – Peter – 2014-09-11T08:03:00.903

Thanks. The problem is this is the work computer so I can't really fiddle with the hardware. But I did increase the page file and it appears to be slightly better already. – yoki – 2014-09-11T08:25:48.267