Bugzilla – Bug 196
[vmcore] OpaqueType objects memory leak
Last modified: 2003-12-23 17:59:01
You need to log in before you can comment on or make changes to this bug.
Valgrind reports that many OpaqueType objects are routinely leaked by LLVM, routinely adding up to 1.5MB or so. -Chris
The main patch is here: http://mail.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20031222/010442.html The problem was that the PATypeHolder object was addref'ing types when it was created, but not dropRef'ing the type when it was destroyed. Whoops. Fixing this exposed the following latent bugs in the asmparser: http://mail.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20031222/010439.html http://mail.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20031222/010440.html -Chris
Oh in case anyone cares, here's the typical valgrind output that this fixes: 64 bytes in 1 blocks are definitely lost in loss record 2 of 4 at 0x40028B85: __builtin_new (vg_replace_malloc.c:172) by 0x40028BF0: operator new(unsigned) (vg_replace_malloc.c:185) by 0x8242F83: llvm::OpaqueType::get() (DerivedTypes.h:430) by 0x8231BB5: llvm::getTypeVal(llvm::ValID const&, bool) (llvmAsmParser.y:274) by 0x8234CE4: llvmAsmparse() (llvmAsmParser.y:913) by 0x82337F6: llvm::RunVMAsmParser(std::string const&, _IO_FILE*) (llvmAsmParser.y:643) by 0x8231213: llvm::ParseAssemblyFile(std::string const&) (Parser.cpp:35) by 0x822D71C: main (gccas.cpp:105) Though anything that creates Opaque or otherwise abstract types can be found to be the leak, including the bytecode reader. -Chris