← all projects

Stormlog Leaks Lab

Hands-on catalog of four PyTorch memory leak patterns on Apple Silicon

PythonPyTorchStormlogMPS2026

A hands-on catalog of four common PyTorch memory leaks on Apple Silicon's MPS backend, each demonstrated on a real workload (CIFAR-10 with ResNet-18) and fixed with a minimal code change. Covers forward hook activations, missing zero_grad, device tensor retention, and autocast scope issues, all profiled using Stormlog. Built to stress-test the profiler on diverse leak patterns and document how the same code can leak on MPS while staying quiet on CUDA.