[analyzer] Allow ownership_returns to opt out of memory leak warnings
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
Hi,
I'm working on using ownership_returns etc annotations for postgres. Unfortunately, for some of the allocators, postgres uses an arena style allocator (which are called memory contexts in postgres), where individual memory often is intentionally not freed, as it's considerably cheaper to throw away the entire context, rather than each individual allocation.
We also at times are using plain allocators, where we do *not* want to ignore memory leak warnings.
Therefore I'd like a way to tell the analyzer that for a certain allocator functions we would like to opt out of leak warnings.
I've tried some workarounds, like replacing all the allocators with an inline function that pass the returned pointer to an external function - which suffices to silence the leak warning - but that doesn't really scale to the number of functions that should signal that they return newly allocated memory.
We still would like to have use-after-free warnings etc.
Greetings,
Andres
Contributor guide
Research direction
The issue names no files, tests, or entry points. Start by locating the analyzer's ownership_returns handling and memory-leak warning path, then determine how allocator-specific opt-outs can preserve use-after-free warnings; done means configured arena allocators suppress leak warnings while ordinary allocators still report them.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- postgresql
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100