[cfe-dev] [PATCH 1/1] StaticAnalyzer: fix memleak in CFRefCount
Ted Kremenek
kremenek at apple.com
Wed Apr 27 23:26:52 PDT 2011
On Apr 27, 2011, at 11:19 PM, Jiri Slaby wrote:
> On 04/28/2011 12:27 AM, Ted Kremenek wrote:
>> Hi Jiri,
>>
>> I think what you are seeing is code in transition.
>>
>> BugTypes were previously deallocated by the BugReporter class. Now they aren't, because Checkers can outlive a BugReporter (since Checkers are now managed by CheckerManager). I think the right approach is to actually reference count BugTypes if we are concerned about BugReporter objects outliving a Checker object. Alternatively, we can have checkers own them, managing them with an llvm::OwningPtr<>. Note that this leak is not actually a big deal right now since Checkers stay persistent for the for the analysis of an entire translation unit (so we're not leaking on every function analyzed), but I agree we should clean this up.
>
> Hi, thanks for the feedback. I'll look if I'm able to fix this up myself.
>
> thanks,
> --
> js
Great. The lifetime of these objects are gradually evolving, so an using an IntrusiveRefCntPtr may be the best way to go.
More information about the cfe-dev
mailing list