What is a Memory Leak? How to Prevent it?

A Memory Leak happens when the resources did not return to the system of the app you were using. The usage of your memory is increased in the task manager and the performance of your PC is decreased. This usually happens when you do not have enough amount of RAM in your PC and the memory required is way above your RAM capacity.

Memory Leak

This is similar to getting High CPU usage on your PC. This can be prevented in multiple ways, as the causes can be multiple too.

This can be fixed in multiple ways and this is not as severe as getting High CPU usage. This can be fixed by Restarting your PC, closing certain apps, disabling certain services.

Restart Your PC:

This is not a permanent solution or fix, but this can temporarily fix this issue while we look for a permanent fix. Restarting your pc is going to clear all the data that was making it use this much RAM. Restarting your PC solves the issue in most cases, at least temporarily.
To restart your PC:

  1. Click on the Windows logo on the bottom right of your screen, or click on the Windows button on your PC
    Windows Button
  2. Click on the Power Button
  3. Click on restart

This should at least make your PC useable if it was not before.

Disable Services:

You can disable the service that is using most of your RAM from the task manager. Services perform a most automated task on PC or listen to data requests from other apps.

Then it makes sense to use memory but not to this extent. The task manager helps you in this scenario by telling you which service or application is using the most memory.

To disable the service that is using the most memory:

  1. Press Ctrl + Shift + Esc to open the task manager
  2. Here you can find the service that is using the most memory
    Remember the name of the service

    Memory Usage
  3. Press windows+R
  4. Type services.msc
    Win+R
  5. Now find the service that was using the most memory in the task manager
    SysMain
  6. Double click on the service
  7. Click on the Stop button
  8. Change the Startup type to Disabled
    Stop SysMain

This is going to disable the service, preventing it from ever starting again and using your RAM causing your PC to lose performance.

Disable Common Leaking Services:

There are some of the more common services that cause memory leaks. These services are known for this problem, as these services were found amongst most people.

  1. Open services by typing services in the search bar
    Services Launch
  2. Find the Service IP Helper, click on it and press the stop & disable button
    IP Helper

This service might be one of the reasons that you’re getting a memory leak on a PC. This service is found in those PCs which have memory leaks and are struggling to perform

Note: If you’re worried that disabling this is going to harm your PC, this enables you to use IPV6 so disabling this is not harmful at all

3.  Next service you have to delete is Superfetch

SuperFetch

This service is known as one of the lethal when it comes to memory leaks. This service can cause Blue screens or it can even crash your PC. It’s better to stop it from interfering with your PC

Disable Services from Registry Editor:

Some services are not able to be stopped or disabled from services or anywhere else. This is one of the most delicate methods, one wrong step and you can mess up your PC. Make sure you make a Restore Point.

  1. Open your search bar, type Registry Editor
    Regedit
  2. Expand HEY_LOCAL_MACHINE

    HKEY_LOCAL_MACHINE
  3. Next, Under system Expand Controlset001

    Controllset001
  4. Click on Services
    Services
  5. Now, Find NDU

    N
  6. Click on Start
    Click Start
  7. Click on it and change the value to 4
    Value 4

Changing the value to 4 is going to disable it as 4 is an invalid value for this service. This service was known for crashing your PC.

Google Chrome using too much RAM:

Google Chrome is one the best browsers in history but everything has its downside. Google Chrome sometimes uses large amounts of RAM. People can use other browsers too like Opera GX, Microsoft Edge, Firefox, but once you have used Google Chrome you cannot get used to anything else. It’s like using an iPhone for months then switching to android.

Chrome Using RAM

There are multiple ways you can stop Google Chrome from using too much memory. For instance, you can disable extensions, turn off Hardware Acceleration, etc. For more info Click Here

How can I Prevent This?

There are multiple ways to prevent this. This problem is not caused by one specific reason, there can be multiple Hardware or Software reasons as to why this is happening.

These are the methods you can Follow:

Upgrade your RAM:

RAM is the main problem here, this might not be a software issue you probably just have to upgrade your RAM. PCs can even run on 1GB of RAM but this is not good for multi-tasking or productive work. Memory leaks are possible when you have less amount of RAM, then the usage increases too.

Nowadays 8GB of RAM is more than enough for this type of work. 16GB is the sweet spot for gaming if you want to game.

RAM

Anti-virus Scans:

Keep scanning your PC after 1-4 days to check if you have viruses or not. This will keep your PC safe from Memory Leaks and other stuff too. People install Anti-viruses and just forget about them, these are very important software and are made for a reason. Keep your PC safe.

Anti Virus

Keep your Drivers Updated:

If you have any of your Drivers not updated, you should definitely update them. Not keeping your Drivers up to date can not only cause Memory Leaks but this can lead to lower fps in games, slow performing PC, PC blacking out, and various other problems.

The graphic card is not going to work at its full potential and you’re not going to have the gaming experience you want.

GeForce Experience

Disable Startup programs:

Make sure you don’t have any unnecessary programs in the startup menu. These programs can easily cause a Memory Leak without you knowing it.

To check what apps you have enabled at startup:

  1. Press Ctrl+Shift+Esc
  2. Click on startup
    Task Manager

    Here you can see all the apps that can launch when the PC is booted into windows.

  3. To disable an app just right click on it and press disable
    Startup
ABOUT THE AUTHOR

Hamza Mohammad Anwar


Hamza Mohammad Anwar is an intermediate JavaScript web developer with a focus on developing high-performance applications using MERN technologies. His skill set includes expertise in ReactJS, MongoDB, Express NodeJS, and other related technologies. Hamza is also a Google IT Certified professional, which highlights his competence in IT support. As an avid problem-solver, he recreates errors on his computer to troubleshoot and find solutions to various technical issues.