[LLVMdev] Memory management and LLVM types
ejones at uwaterloo.ca
Tue Nov 1 16:08:36 PST 2005
I am somewhat confused about how I should go about releasing LLVM
types. Some types are owned by a Module, and others I am not sure
about. Are there any general rules or guidelines that I should be aware
of? It appears to me that whenever I am passing a "new" object into a
container type like a module or basic block that the container owns the
object. Is that accurate? If this is true, why does it work for me to:
- Load a module from bytecode.
- Get some pointers to types inside that module.
- Delete the module.
- Use these types again.
I'm using electric fence, so I don't *think* that it is luck, but I
could be wrong. Should I be deleting the pointers that I get out of the
A related question is how should I delete the module? I see that there
is a "dropAllReferences" method. Is this called automatically for me
from the Module's destructor?
More information about the llvm-dev