Problem solve Get help with specific problems with your technologies, process and projects.

Memory leaks: Finding a memory leak in Microsoft Windows

Applications with memory leaks can kill server performance and even render a server unstable. But memory leaks are not always obvious. Here's how to know if you've got one.

Before investing in server hardware, most companies spend a good deal of time researching the resources required...

to run the applications that the server will be hosting. But all this hard work can be undone by a poorly written application.

Over time, some applications can rob your server of resources far beyond any reasonable estimates. Applications with memory leaks or applications that consume excessive amounts of processor time can not only kill server performance, but can also render that server unstable.

Memory issues with applications

Applications usually request memory from the OS in order to perform various functions. Under normal circumstances, an application will release memory once it has finished using it. A leaky application will request memory like any other application, but will not release the memory that is no longer needed.

The next time that the application runs the function that required the additional memory, the application will not use the memory that it is already consuming. In fact, it will request even more memory from the OS. The leaky app continues to hold onto this memory even after it is no longer needed. Over time the leaky app will drain the OS of more and more memory.

Memory leaks are not always obvious. There is no dialog box in Microsoft Windows that says, "You have a memory leak." It's up to you to find memory leaks, and corrrect them. But how do you know if you've got one?

Symptoms of memory leaks 

The symptoms of a memory leak vary. They depend on the amount of memory the leaky app consumes each time the leaky code is executed, as well as how often the leaky code is executed. The frequency with which the system is rebooted also makes a difference, since memory is restored to the OS during a reboot.

Some memory leaks are barely noticeable. But if one becomes significant enough to start affecting the OS, you'll see some telltale signs. Including:

  • The system gradually becomes slower. Sure, it's normal for a system to slow down over time to some extent, due to disk fragmentation, the installation of bloated applications and the overhead associated with an increasing workload. What isn't normal is for a system's speed to be restored after a reboot, only to quickly begin slowing down again. This is often a sign of a memory leak (although it can also mean a malware infection).

  • Unexpected error messages indicating that various system services have stopped. Note: Again, these types of messages might be caused by malware infections or other types of system problems. If system services are shutting down unexpectedly, it is generally not a sign of a memory leak unless other symptoms are also occurring.

  • An error message indicating that Windows is either low on, or has run out of, virtual memory. Below is a typical sample of this type of error message, but the exact messsage will vary, depending upon the version of Windows your server is running.

More on Computer Memory

  • Learn what do when Performance Monitor yields unexpected results.

How to detect a memory leak in Microsoft Windows

  Memory leaks: Finding a memory leak in Microsoft Windows 
  Finding memory leaks using Performance Monitor 
  Memory leaks: Determine an applications CPU consumption 

Dig Deeper on Windows Server storage management