C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Deliberate memory leak

From: Jonathan Wakely <cxx_at_[hidden]>
Date: Fri, 11 Oct 2024 12:52:25 +0100
On Fri, 11 Oct 2024 at 12:13, Frederick Virchanza Gotham via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> There are times when we allocate memory which we never intend to
> deallocate. For example, I'm writing a program at the moment that
> loads in plugins, and the plugins stay loaded until the end of the
> program.
>
> The only problem with this is that when you run a debugging tool to
> detect memory leaks, you get a load of false positives. I had a
> program before that linked with libpango, and I spent ages trying to
> find a memory leak, wondering if I was misusing the library or if the
> library internally had a bug, and I went the whole hog and joined the
> libpango mailing list and shared all my debugging output. In the end
> it turned out to be a benign memory leak -- i.e. the allocation
> happened once in the program and was intended to last the entire
> program.
>

They should provide instructions on suppressing the leak detection for
tools such as valgrind and Asan.
 This is a tooling problem, not a C++ one.

Received on 2024-10-11 11:53:43