I'm downloading torrent with StackExchange data dump. There was about 40% done, today when I clicked resume, the computer hanged and was practically unusable for about 30 minutes.

After a few minutes process explorer opened and I've found out that the memory consumption was at the level 95% (from 3GB), which was an explanation why processing every click takes so long. However, though I've displayed all processes, I wasn't able to find anyone who was using so much memory. The Opera itself was using about 150MB. Avast was almost invisible when it goes to memory usage and CPU consumption.

My machine has 3GB RAM and Windows7 64 bit installed. The antivirus is Avast. The data dump has about 11GB.

What process could cause so much memory usage in torrent files check phase? This process was invisible in show-processes-of-all-users mode.


Grab the SysInternal tool called RAMMap.

Your memory is being consumed by what are known as memory-mapped files. This is where the OS loads a chunk of a large file into memory for access at a process' request because it's much more efficient for random requests than repeatedly seeking to locations in the file on disk.

Torrent programs do a LOT of random access to files, so I'd be willing to bet that Opera Torrent mmaps (memory-maps) its files; in all honesty, this is the best thing for a torrent client to do.

The problem here is that during file check, Opera Torrent will access the entire file sequentially. This causes Windows to load the entire file into memory, or try to. Normally, it only has the chunks of the file that are being downloaded in memory, but now all your memory is being used since Windows thinks that Opera Torrent needs the whole file to stay in memory.

The reason the mmapped-file is not attributed to Opera Torrent is because mmapped-files are shared amongst processes. Sure, Opera Torrent may have requested the file to be memory-mapped, but if you open it with 7Zip, then it'll have access to the same memory-mapped file. No need to waste memory loading it twice! But now, who "owns" the file?

  • Hmmm so the reason is probably poor implementation of memory-mapped files in Windows and not poorly written Opera or Antivir? Well, there is a saying: he who uses windows is himself guilty – Danubian Sailor May 16 '13 at 16:55
  • It's not really a poor implementation in Windows; More correctly is poor usage by Opera Torrent. Opera Torrent probably should not use the memory-mapped file handles that it already has open in this case, and do a direct disk read with caching disabled. The complicated part is on my system (32GB of RAM), doing a cached read from the memory-mapped file would be just fine, and much, much faster than a direct disk read. The problem is there's no easy way to automatically know which is best for a particular system. – Darth Android May 16 '13 at 16:58
  • @ŁukaszLech - The implementation is not poor. You don't have enough memory to run both a torrent likely downloading a TON of data at once and have free memory. Adjust the settings on the client to download less data at once. – Ramhound May 16 '13 at 17:07
  • Keeping the UI responsive in the face of changing system loads is a core responsibility for a desktop operating system. Having a system become usable for 30 minutes can't be described any other way than failure at this basic task. – Kyle Jones May 16 '13 at 17:09
  • @KyleJones How does Windows know that opera doesn't need that memory-mapped file to keep the UI responsive? Windows does its best to guess what you're going to do next and be ready, but it doesn't do it at the expense of system resources. My system runs for days without me opening task manager- I don't want ~130MB of RAM reserved when I'm not using it. It would take more than 1GB of ram to ensure that Windows Explorer was 100% responsive, another 1GB to keep the kernel 100% responsive to everything the user could do... That's a lot of wasted memory to protect against what are rare conditions – Darth Android May 16 '13 at 17:18

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.