Memory leaks and soak-test analysis
Prove a slow leak by running a long test, reading memory after clean-up and comparing snapshots, and tell it from a full connection pool.
L1–L4 are part of the Pro pass
L0 Explain simply
Analogy: a bath with a slow leak. Watch the bath for a minute and the water looks the same. Come back after three hours and it is half empty. The leak was there all along. This slow example needs a long observation; a larger leak may become visible quickly.
Daily List is a to-do list app. Its reminder service gets slower every night and, some mornings, it stops. A short test shows nothing wrong. Tom suspects unwanted memory retention; the service may be keeping allocations it no longer needs.
So he runs a long test with a steady load. He writes down the memory used every few minutes, right after the service tidies up. Each reading is a little higher than the last. The low points keep rising.
This is analysis: running a system for a long time and reading the memory to see whether a slow leak is there.
The picture has a limit. A bath has one drain. A program can retain unwanted allocations through several paths. The analogy reverses direction: bath water falls, while held memory can rise.
(SYNTHETIC / TRAINING ONLY: Daily List and every person named in this lesson are invented.)
PICTURE IT
The picture is the one the lesson above opens with. The table below shows how each part of it matches the software.
THE REAL JOB Proving a slow loss of memory by watching low points over hours and comparing two snapshots.
- Run for hours
- Read the low points
- Compare two dumps
- Fix and rerun
HOW THE PICTURE MAPS
| In the picture | In the software |
|---|---|
| A bath with a slow leak | A service that loses memory |
| The water level after an hour | Memory after a clean-up |
| A photo of the bath early and late | Two heap dumps |
| The drain that is not shut | The code that never gives memory back |
WHERE THIS PICTURE STOPS
- A bath has one drain. A program can leak in many places.
- You can see the bath. Memory needs a tool.
- A bath leak is steady. A program leak can speed up.
HOOK
Watch the low points, compare two snapshots.
REMEMBER IT THIS WAY
A rule of thumb: if you see this, think that.
If the low points creep up hour after hour, usually the service is losing memory a little at a time.
| In the trick | What it stands for |
|---|---|
| Low points | memory used right after cleanup |
| Creep up | losing memory a little at a time |
A cache is still filling and will level off, which looks the same at first.
TELL A FRIEND
A bath with a slow leak. The level only shows the leak if you watch for hours, and photos at two times show where the water went.
OFTEN MIXED UP WITH Performance analysis and bottlenecks. The analysis lesson finds a part that limits speed. This lesson finds a part that slowly loses memory.
PRACTISE AND KEEP
Sources for this topic — 5 sources
- Market practiceJava SE 17
HotSpot Virtual Machine Garbage Collection Tuning Guide ↗ — Oracle · How the Java garbage collector frees memory and how the heap is organised into generations (search excerpt, page not opened)
Opened Oracle Java 17 Garbage Collector Ergonomics on 6 November 2026. Include pauses in latency attribution without double-counting a pause already inside a measured compute interval.
- Market practice
tracemalloc: Trace memory allocations (Python 3.12 documentation) ↗ — Python Software Foundation · Take two snapshots of memory use and compare them to see where memory grows (search excerpt, page not opened)
Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.
- Market practice
Memory leak diagnosis with garbage collection logs and heap dump comparison (Huawei Kunpeng documentation) ↗ — Huawei · A leak signature: old-generation memory stays high after full collections; compare two heap dumps to see which classes keep growing (search excerpt, page not opened)
Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.
- Market practice
Dynamic analysis tool (ISTQB glossary study page) ↗ — SoftwareTestPilot · Closes CTAL-TTA dynamic analysis (wild pointers). Course outlines place wild pointers and memory leak detection under dynamic analysis (excerpt). A 2010 ISTQB-related term list includes 'wild pointer'; its definition was not seen. No claim is made about which languages allow it.
Found through a web search; the page was not opened (search excerpt, page not opened). Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.
- Market practice
Analysis tools lecture slides (Purify) ↗ — Harvey Mudd College CS121 · Closes CTAL-TTA dynamic analysis (wild pointers). Course outlines place wild pointers and memory leak detection under dynamic analysis (excerpt). A 2010 ISTQB-related term list includes 'wild pointer'; its definition was not seen. No claim is made about which languages allow it.
Found through a web search; the page was not opened (search excerpt, page not opened). Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.
Deepest material on this page: L4 — Standards & sources. Where a topic stops short of implementation depth, that is a deliberate coverage decision, not an oversight — see coverage.