Avoid memory leaks

Avoid memory leaks in C++ — with the four heights of help laid out: do it now, make it easier for the next person to accept, work out the right move when you are stuck, and learn the pattern so it stops coming back.

4prompt heights
Open it in the interactive atlas →

The four heights

The same task, four distances: today's deadline, the next reviewer, the stuck moment, the pattern.

Execute — do the immediate task

+
There are several modules with intermittent leaks reported by ASan and Valgrind. Run a targeted…
There are several modules with intermittent leaks reported by ASan and Valgrind. Run a targeted sweep: reproduce the leak with the unit tests, identify the allocation stack traces, replace the leaking allocations with owning smart pointers or ensure proper delete in destructors, and re-run tests to prove no leak remains. Push fixes to hotfix/leak-fix, notify QA, and close bug 4821 by Thursday.

Improve — make it easier to accept

+
Before I hand this to QA, make the leak fixes easy to verify: list the specific allocations you…
Before I hand this to QA, make the leak fixes easy to verify: list the specific allocations you changed, show the before/after ASan or Valgrind snippets, summarize why each leak happened and how the fix ensures deterministic cleanup. Highlight any remaining risky code paths that still use bare new or manual resource management.

Decide — diagnose the stuck moment

+
Valgrind shows leaked objects allocated in our manager but the stack trace goes through a…

A Valgrind report shows leaked objects but stack traces point into third-party code

Valgrind shows leaked objects allocated in our manager but the stack trace goes through a third-party library. I maintain the networking module and Jim owns the library integration; I'm worried the leak is either ours for failing to free callbacks or theirs for not releasing internal buffers. I cannot tell from the trace who must free what. What's the likely diagnosis and the fastest next step to prove ownership and fix it?

Become — change the pattern

+
Across multiple releases we keep spending days chasing leaks caused by inconsistent ownership of…

We spend days chasing leaks that originate from the same pattern

Across multiple releases we keep spending days chasing leaks caused by inconsistent ownership of callbacks and resource pools. I lose time in repro, blame passes between teams, and credibility suffers. What systemic habit or small tooling change will stop this recurring waste, and how do I enforce it in PRs and test suites?

Next to this one

Other programming language work people do in C++.

Every task here came from the work, not from a feature list — which is why the prompts name what you want done and never the button that does it. The tool changes; the work does not.
Copyright © LLOS.ai · 2026 — original pedagogy, voice, and design — all rights reserved.

The rest of the map

Same library, five ways in.