[cfe-dev] [PATCH 1/1] StaticAnalyzer: fix memleak in CFRefCount

Jiri Slaby jirislaby at gmail.com
Wed Apr 27 23:19:48 PDT 2011


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



More information about the cfe-dev mailing list