[LLVMdev] Memory leaks revisited (and many fixed)

Morten Ofstad morten at hue.no
Fri Nov 19 08:12:22 PST 2004


Hi,

I finally took the time to track down the remaining memory leaks beside 
the LeakDetector objects and TypeMaps/ValueMaps I already knew about. It 
turns out almost all of them came from the command line options module, 
so I cleaned up the patch for LeakDetector and made a new patch for 
CommandLine. The patches are attached to this message.

That got rid of all but 4 leaks I'm getting, but of course there are 
more of the same waiting to happen - the pattern of creating singletons 
with new instead of having static objects inside accessor functions is 
very common in LLVM. The four leaks are caused by the ConstantBool::True 
and ConstantBool::False (1 for each object + 1 for the use list dummy) - 
  unfortunately they are not so easy to wrap with accessor functions 
since they are public member variables of the ConstantBool class... If 
only everyone used the ConstantBool::get() there would be no problem, 
but that's not the case. Any suggestions?

m.

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: leaks.patch
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20041119/144d9891/attachment.ksh>


More information about the llvm-dev mailing list