# Three kinds of memory leaks

DevFeed: [Three kinds of memory leaks](<https://devfeed.tech/articles/three-kinds-of-memory-leaks-21972.md>)

Original publisher: [Read original article](<https://blog.nelhage.com/post/three-kinds-of-leaks/>)

Author: Nelson Elhage

Published: 2018-04-29T15:30:00Z

Content type: tutorial

Language: en

Sources: [Nelson Elhage](<https://devfeed.tech/sources/nelson-elhage.md>)

Topics: [Memory Leaks](<https://devfeed.tech/topics/memory-leaks.md>), [debug](<https://devfeed.tech/topics/debug.md>), [C](<https://devfeed.tech/topics/c.md>), [C++](<https://devfeed.tech/topics/c-plus-plus.md>), [Caching](<https://devfeed.tech/topics/caching.md>), [Object-relational mapping](<https://devfeed.tech/topics/orm.md>), [Streaming](<https://devfeed.tech/topics/streaming.md>)

Tags: [c](<https://devfeed.tech/tags/c.md>), [c-plus-plus](<https://devfeed.tech/tags/c-plus-plus.md>), [debug](<https://devfeed.tech/tags/debug.md>), [memory-leaks](<https://devfeed.tech/tags/memory-leaks.md>), [techniques](<https://devfeed.tech/tags/techniques.md>), [tools](<https://devfeed.tech/tags/tools.md>)

## AI overview

The article explains that apparent memory leaks generally fall into three categories with different behaviors and debugging approaches. It discusses unreachable allocations, unexpectedly long-lived allocations, and tools such as ASAN, Valgrind, heap profiling, and core dumps.

## Source excerpt

So, you've got a program that's using more and more over time as it runs. Probably you can immediately identify this as a likely symptom of a memory leak. But when we say "memory leak", what do we actually mean? In my experience, apparent memory leaks divide into three broad categories, each with somewhat different behavior, and requiring distinct tools and approaches to debug. This post aims to describe these classes, and provide tools and techniques for figuring out both which class you're dealing with, and how to find the leak.