C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Deliberate memory leak

From: Thiago Macieira <thiago_at_[hidden]>
Date: Fri, 11 Oct 2024 07:55:58 -0700
On Friday 11 October 2024 04:52:25 GMT-7 Jonathan Wakely via Std-Proposals
wrote:
> 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.

It's also likely a tooling problem that it was detected as a leak in the first
place. If the pointer is still reachable when the program exited, it's not a
leak. Valgrind reports those as potential leaks and requires an extra flag to
list still-reachable memory.

But sometimes it gets confused because of plugins, as those get unloaded
before the program completely exits and thus the memory becomes unreachable.
This is a shortcoming of the tool.

Before anyone asks about freeing memory when plugins unload, C++ plugins don't
unload - if you've used *any* static inline variable, then your plugin is
marked NODELETE.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Principal Engineer - Intel DCAI Platform & System Engineering

Received on 2024-10-11 14:56:02