The term “memory leak” gets thrown around when troubleshooting technical problems on a computer, especially problems with application slowdowns or crashes. But what does that really mean to the average user?
To be clear, RAM isn’t physically leaking from your computer (although that would also be bad) – this issue refers to a software bug in how a computer is storing information. macOS occasionally runs into problems with memory leaks, so it can be useful to know just what the issue is, and how to recognize if it might be happening. Here’s everything you need to know!
Memory Leak Definition
Computer “memory” is RAM, or a specialized short-term storage space that is used by the computer to run all active tasks. The more RAM a computer has, the more activity it can handle. This is why looking at RAM is important when shopping for a new computer.
A memory leak occurs when software uses RAM incorrectly. Specifically, when it continues to use RAM that it no longer needs.
In this case, an application or platform takes a portion of RAM storage for its tasks and runs them as it should. But when you stop that task or close the app, it doesn’t give that RAM storage back. This doesn’t just happen once – it happens every time the software does that particular task, locking down more and more RAM until your computer can’t operate.
This is also why memory leaks are particularly dangerous when they happen with background software that runs continuously, because this can quickly block out all the RAM on your computer
This is clearly not intentional and is almost always caused by a serious bug that has deleted or skipped the step where RAM is allocated back to storage so it can be used again. Let’s look at the signs that it’s happening.
Memory Leak Symptoms
A typical memory leak will have the same symptoms as a computer that doesn’t have enough RAM to run its apps (you see this with low-RAM computers when they try to run demanding games, lots of 4K footage, or complex design software). Usually, a computer will try to make emergency space in its longer-term storage drive to hold extra RAM data, which will cause slowdowns and performance issues.
But with a memory leak, this stopgap solution isn’t effective, and your computer eventually chugs to a halt. This usually means that the computer can’t open another app or program without crashing entirely. Or it will simply freeze entirely and force you to reboot to get things started again.
Some memory leaks are subtle and happen over time. If you frequently shut down your computer, that RAM is usually returned and you may not notice much of an issue unless you leave the program running for a long time. One way to pick up on a memory leak before serious problems occur is to use resource monitors or RAM trackers to look at how much RAM is being used. If RAM use is ramping up over time without reason (no additional programs are being run), that’s a pretty good sign there is a memory leak somewhere.
Specific Causes of Memory Leaks
We said memory leaks are caused by a bug in the software – but what does that look like, and how is it located? This can get technical because it’s usually a flaw buried in the code constructed around returning RAM for a particular task.
Ordinarily, both allocating and returning RAM are key parts of the code for any software task. A leak occurs when coders allocate memory “on the heap” or memory specifically made available to that program for dynamic tasks, but then forget to add the code to “free” that memory when the task is done – or accidentally delete that code section. It can also be caused by changes in the way operating systems use memory so that past coding is now incorrect, although this is less common.
Ideally, this sort of major coding error is caught during tests and early betas, because it tends to be an obvious problem. To have a memory leak get all the way to the average user can be a sign of shoddy work, or harsh deadlines that force developers to skip more thorough testing.
MacOS Memory Leaks
Occasionally, memory leaks do crop up on the macOS operating system. The most current example is in macOS Catalina 10.15.6, where a problem with the App Sandbox made creating a virtual desktop difficult because of a small but constant memory leak that eventually led to “kernel panic” where the computer crashes due to lack of resources.
However, memory leaks from Apple’s own software are rare. More common are memory leaks from third-party apps that have bugs of their own.
What to Do When You Encounter a Memory Leak
First, try shutting down your computer entirely and rebooting. If it still looks like memory issues are occurring, you can monitor app activity and try to narrow down which app is creating the memory leak (keep in mind that memory leaks can also be caused by browsers like Chrome or Firefox).
If the problematic app has a new update available, make sure it’s fully updated. Otherwise, see if you can roll it back or replace it with an earlier version of the app that doesn’t have the bug.
If the problem appears to be related to the operating system after an update, you should also try resetting the PRAM and NVRAM, which may fix the problem. Otherwise, there isn’t much you can do except wait for an update to patch the leak.