The Minimum You Should Do To Prevent Memory Leaks in Swift

In this episode, we continue the Clean Swift Tests discussion, and we demonstrate a way for preventing memory leaks through automated testing.

There's a large class of bugs, security threats and user experience problems (e.g. crashes and high memory consumption) related to memory leaks. Although this is an important topic, why do the majority of apps (Apple included) fail to prevent memory leaks?

Answer: many developers rely on error-prone manual checks.

Manual checks might seem like a good fit in early stages. However, the codebase expands, requirements change, new developers join the team, pressure builds up, and deadlines approach. Under those stressful conditions, the manual checks have a high probability of failure due to human error. Moreover, the number of possible combination checks are too many, and they grow exponentially, which makes it humanly impossible to check all logical branches. Can we avoid such a scenario?

Answer: yes, with good architecture and automated tests!


Subscribe now to our Youtube channel and catch free new episodes every week.


We’ve been helping dedicated developers to get from low paying jobs to high tier roles – sometimes in a matter of weeks! To do so, we continuously run and share free market researches on how to improve your skills with Empathy, Integrity, and Economics in mind. If you want to step up in your career, access now our latest research for free.