What you should know about memory leaks

Have you ever noticed that your browser slows down after running for a while? Heck, most times the whole computer slows down after running for a while. This is primarily because a program requested a chunk of memory and not releasing that chunk when said program is done. This is called a memory leak.

When I speak of memory, I’m speaking of RAM, not the hard drive. RAM forgets everything when the computer turns off. The hard drive stores the programs, music, e-mails, etc. while the computer is off. At least until the hard drive fails, and it will one day. Reason #1 to Make Backups!

Every program uses RAM. It’s impossible to run a program without copying it to RAM first. On top of that, when a program needs more RAM, it requests it from the operating system. Once the program exits, the OS should release that RAM so another program can use it. Sadly, this is not always the case.

Checking for Leaks

It’s quite easy to check for memory leaks for a specific program. If you’re running Windows:

  1. Right click on the task bar and select task manager
  2. Click on the Processes tab
  3. Select Options -> Select Columns…
  4. Check the VM Size and Mem Usage
  5. Click OK
  6. Run the program, if its not already running
  7. Keep a watch on it’s statistics
  8. If the VM Size and/or Mem Usage keeps going up and not going down, that program has a memory leak!

Note: Once you do steps 3-5, you won’t have to do them again on that computer.

Using Linux or MacOS:

  1. Open a command prompt
  2. Run: top
  3. The columns to watch at Virt(ual Memory) and  Res(idual Memory)
  4. Run the program, if its not already running
  5. Keep a watch on it’s statistics
  6. If Virt and/or Res keeps going up and not going down, that program has a memory leak!

Note: Press h for help while running top.

Most Leaks Occur in the Browser

Sadly, tons websites have memory leaks. To check for this:

  1. Do steps 1-5 above or run top
  2. Load up your browser
  3. Go directly to Google.com(No Leaks There!)
  4. Check the VM Size and Mem Usage
  5. Go to a site that regularly slows your browser down
  6. Check the numbers, they should have gone up
  7. Go back to Google.com
  8. Check the numbers again

If they don’t go down at all, you can almost guarantee that that website has at least one memory leak. I’ve noticed this is especially true for Cafe World and Frontierville on Facebook, but almost all flash-based game will have memory leaks because flash has memory leaks. That is why the newer versions of Firefox runs flash as a separate program.

Luckily, all you have to do is restart your browser and those numbers will be reset. Setting your homepage to something simple that doesn’t leak, about:blank is good, can help too.

Memory Leaks Are NOT Dangerous

These leaks are not dangerous, just frustrating and annoying. Restarting the program or computer will speed things back up. That’s not a permanent solution, but it is usually the easiest fix.

Another option is to call tech support, but most of the time they can’t do anything for you except forward your complaint to the proper department and tell you to restart your computer or the program. If you choose this option, make sure to have all your number written down before you even call.

Sometimes, the best solution is to just stop using that program or website. Find an alternative that doesn’t have memory leaks. You might even find a gem in the rough.