Web Excursions 2021-11-06
Memory leaks
when [an app's] allocated memory is no longer required, it has to be freed and returned for reuse.
In a memory leak that return doesn’t happen, and instead of the memory being freed it’s left still in use.
At certain point, the leaking app comes to a grinding halt.
[There're] different pools of memory in your Mac [which] fall into two main groups: kernel and user memory.
User or app memory leaks are far more common, and most often occur because the developer forgets to make a call to free memory when it’s no longer required.
The first indication that there might be a memory leak somewhere is normally a noticeable fall in performance.
When there’s a significant memory leak in an app, your Mac will eventually be forced to use swap space, and that’s another tell-tale sign of a leak.
The use of modern high-level programming languages like Objective-C and Swift has reduced these,
as most memory allocation and freeing is handled automatically,
so there are no calls normally required to deallocate memory.
Most of the older frameworks of macOS still rely heavily on the code manually deallocating memory when it’s no longer required, and that catches developers out.
For the user, there’s one good way to live with app memory leaks: quitting the app should return all the memory that was allocated to it.
Kernel memory leaks are not only more serious, but there’s usually nothing the user can do apart from restarting the Mac.
The last major kernel memory leak occurred in the Catalina 10.15.6 update in July 2020, right at the end of its development cycle.
the first action should always be to uninstall all non-essential kernel extensions
Most kernel memory leaks occur in special pools of memory reserved for ready use by the kernel and its extensions, known as Mach zones
Mach zones aren’t normally open to inspection by the user,
except with the
sudo zprint
command,which provides a long list of each of the Mach zones in use and figures for their usage.
Explainer: chipsets and Fabric
[Traditional components of a chipset]
Northbridge chips interface the main processor to high-speed devices,
including memory and graphics controllers.
Southbridge chips handle connections to lower-speed devices,
which normally include networking via Ethernet, audio, and standard buses such as serial and parallel ports, PCI, ISA and USB.
Chipsets can be developed by manufacturers who don’t make processors themselves.
Apple terms the sections of an M1 chip which replace the traditional chipset its Fabric.
this can be a confusing term, as fabric computing has been used since the mid-1990s to describe high-performance cloud-like computing and what is also known as grid computing.
until 2020 Intel was the sole supplier of chipsets supporting Thunderbolt
Apple appears to be the first SoC designer which has incorporated its own Thunderbolt 3 and 4 in its chips
Although details of the Fabric are vague,
it’s thought that each of its main functional areas is run by its own ARM core,
which resembles a cut-down version of the Efficiency (Icestorm) cores of the original M1
It’s believed that the Fabric of the original M1 probably contains as many as a dozen of these ARM cores.
M1 Pro and Max chips have greatly enhanced Fabric when compared to the original M1.