[LLVMdev] Leaking GlobalVariable from lowerInvoke pass

Morten Ofstad morten at hue.no
Thu Nov 11 08:43:41 PST 2004


Although most of the leaks I detected in LLVM were from singleton 
objects, there also seem to be some real leaks. One such leak (which is 
creating problems for me when I try to get rid of the constant 
singletons) seems to be a GlobalVariable created on line 145 of 
Transforms/Scalar/lowerInvoke.cpp -- any suggestions how I can make sure 
this GlobalVariable gets deleted?

Actually I'm a bit confused in general with how LLVM manages memory and 
I could not find anything in the documentation section -- from what I 
have seen in the source code it seems like bigger structures (Modules, 
BasicBlocks) take ownership of things you put into them (Functions, 
Instructions) and delete them when they are themselves deleted. Is this 
right? So why isn't the GlobalVariable getting deleted?

m.




More information about the llvm-dev mailing list