Find and Fix Angular Memory Leaks – with Measurable Results

Does your Angular app start smoothly but get slower the longer people use it – until only a reload helps? Then it's probably keeping objects in memory that it should have released long ago. I track down these memory leaks in four clear phases, fix them and use repeatable measurements to prove that memory usage stays stable.

How to recognise a memory leak

A memory leak rarely shows up right away. Every navigation leaves something behind: component instances, detached DOM nodes, data held by subscriptions. After hours of use the browser tab takes up several hundred megabytes, garbage collection runs more and more often and the UI starts to lag.

The chart shows such a measurement: the red line keeps climbing with every navigation. After the fix, the blue line shows the typical sawtooth pattern of a healthy web application – memory is allocated and released again.

Chart of JS heap size over 100 iterations: the version with a memory leak (red) grows from about 30 to around 180 MB, while the fixed version (blue) stays at about 30 MB
Heap size over 100 repeated navigations, measured with Playwright: before the fix (red) and after (blue).

Typical causes of memory leaks in Angular

RxJS subscriptions that never end

Subscriptions without the async pipe, takeUntilDestroyed or toSignal live on after the component is destroyed – keeping the component, its template and its data in memory.

Event listeners and timers

Manually registered listeners on window or document, setInterval and observers (resize, intersection, mutation) that aren't removed in ngOnDestroy or via DestroyRef.

Third-party libraries

Charts, editors, maps or viewers whose destroy or dispose method is never called leave detached DOM nodes and internal references behind.

Growing caches and singletons

Services with providedIn: 'root' that collect data, components or callbacks but never clean up grow with every navigation.

My approach in four phases

Each phase has a clear goal, so you always know where we are – and at the end, measurements rather than assumptions show that the leaks are fixed.

Phase 1 of 4

Setup phase

I set up the software environment and build the frontend and backend so they can run locally or in a test environment under production-like conditions.

  • Set up the development environment, dependencies and configuration
  • Build frontend and backend, provide test data
  • Production-like build for meaningful measurements

Goal: A running system that can be measured reproducibly.

Service & price

Angular memory leak analysis & fixes

On request

  • Setup of the application including frontend and backend
  • Identification of critical navigation paths
  • Playwright measurements before and after the fix
  • Fixes for the memory leaks found
  • Short documentation of root causes and changes
Enquire

Is it not just about memory, but also rendering, load time or change detection? Then take a look at Angular performance optimisation.

What clients say

Mr Birke was instrumental in the design, development, and stabilisation of our system. In collaboration, Mr Birke demonstrated a very reliable, independent, and transparent working style. I recommend Fabian Birke unreservedly for MedTech and HealthTech projects.

Joshua Norton Technical Project Lead, LAP Laser GmbH

Angular memory leak FAQ

How do I tell a memory leak from normal memory usage?

Normal memory usage rises and falls again – the sawtooth pattern. With a leak, the heap no longer drops back to its baseline after garbage collection but keeps growing every time a workflow is repeated.

Why Playwright and not just Chrome DevTools?

DevTools help me find the cause. Playwright repeats a workflow hundreds of times under the same conditions. That's what makes small leaks visible and lets us prove objectively that a fix works.

Do you need access to our backend?

For the setup phase I need a running system – either the source code of frontend and backend or access to a test environment. We'll work out which makes sense in the initial call.

Can we keep running the Playwright tests afterwards?

Yes. The tests can be added to your CI pipeline so new leaks are caught before they reach production.

Related services

Let's find your memory leaks

Briefly describe which workflow makes your app slower – I'll tell you how I would set up the analysis.