TOPIC 05/5118 MINNOT STARTED

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.

  1. Run for hours
  2. Read the low points
  3. Compare two dumps
  4. Fix and rerun
Watch the low points, compare two snapshots

HOW THE PICTURE MAPS

How each part of the picture matches the software
In the pictureIn the software
A bath with a slow leakA service that loses memory
The water level after an hourMemory after a clean-up
A photo of the bath early and lateTwo heap dumps
The drain that is not shutThe 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.

What each part of the trick stands for
In the trickWhat it stands for
Low pointsmemory used right after cleanup
Creep uplosing 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
  1. 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)

    Implementation-specific illustration of pause, throughput and memory goals. The maximum pause-time goal is a hint and may not be met; it is not an SLA or screening benchmark. Some collection phases pause application work, while others may be concurrent. · Checked 2026-11-06

    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.

  2. 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)

    Describes taking two snapshots of memory use and comparing them to find where memory grows. Used for the leak example in this lesson. · Checked 2026-10-18

    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.

  3. 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)

    Shows a leak signature (old generation stays high after full collections) and how comparing two heap dumps shows which classes keep growing. Vendor guide. Practitioner guidance, not a standard. · Checked 2026-10-18

    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.

  4. 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.

    Third-party page labelled with the ISTQB definition: run-time information on the state of code, such as memory allocation, use and release and use of pointers; names Valgrind and AddressSanitizer as examples. Check against the official glossary. · Checked 2026-10-19

    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.

  5. 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.

    Lecture deck: accesses through a dangling pointer are reported as Free Memory Read/Write, and corrupted memory may be used much later so the symptom can be far from the cause. · Checked 2026-10-19

    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.