[LLVMdev] LLVM C API Memory management
Eric Dobson
eric.n.dobson at gmail.com
Thu Sep 8 20:46:10 PDT 2011
I am building bindings for LLVM in Racket, and was wondering how does memory management work for the C API. I'm guessing that when a module is disposed of all of the instructions and functions that were inside it are no longer valid, similarly with contexts and types. But what about when I delete a function, are all of the instructions that were inside it invalidated? What if a builder is still located at a basic block inside the function? What about when a global variable is removed, what happen to uses of it?
The reason that I want to know this is that the C style of blowing the world up when something goes wrong doesn't really work in higher level languages, and I want to catch programmer mistakes before that happens and through an exception.
Is there any documentation on this (besides the C++ source)?
-Eric
More information about the llvm-dev
mailing list