[LLVMdev] LLVM and memory leaks

Morten Ofstad morten at hue.no
Thu Nov 11 04:46:19 PST 2004

I guess the issue of singleton objects leaking is not something that he 
LLVM team is very concerned about, since there has been no replies to my 
first mail... But for me it is a big problem. I can't use LLVM in our 
project if it triggers our leak detection system, since it will hide 
other problems.

Since actually deleting these objects is proving difficult (types can 
have circular references, so you have to deal with things getting 
deleted while there are still references to them), I propose to 
introduce a new class SingletonPool to lib/Support which keeps all the 
singleton instances and can be free'd without actually calling the 
destructors, thus stopping our memory leak detection system from 
complaining. All it would require is using new(SingletonPool) when 
creating singleton objects. Is this an acceptable solution that you 
would accept patches for?


More information about the llvm-dev mailing list