Re: [PATCH 1/2] stop calling UNLEAK() before die()
- From
Jeff King <peff@peff.net>
- Date
- Aug 14, 2020, 10:17 UTC
- Message-ID
- <20200814101706.GC3312240@coredump.intra.peff.net>
- In-Reply-To
- <275f3f6c-77ed-fddd-8f79-28f25b257362@gmail.com>
On Thu, Aug 13, 2020 at 02:08:45PM -0400, Derrick Stolee wrote:
Show 11 quoted lines
> On 8/13/2020 11:55 AM, Jeff King wrote: > > The point of UNLEAK() is to make a reference to a variable that is about > > to go out of scope so that leak-checkers will consider it to be > > not-leaked. Doing so right before die() is therefore pointless; even > > though we are about to exit the program, the variable will still be on > > the stack and accessible to leak-checkers. > > > > These annotations aren't really hurting anything, but they clutter the > > code and set a bad example of how to use UNLEAK(). > > Good justification. I'll stop being a bad example ;)
To be fair, it seems clear that UNLEAK() as a concept is rather confusing. I really never intended anybody to start sprinkling it around the code. It was meant to be a tool for folks who are interested in running leak-checkers to do in-code annotations (for "yes, I know this leaks but not until the program effectively ends").
I certainly don't mind if people writing new code preemptively annotate this kind of leak. But I also wouldn't really encourage authors to put a lot of effort into it, given the current state of the annotations.
-Peff