[LLVMdev] How do I free the metadata?

Rafael Ávila de Espíndola rafael.espindola at gmail.com
Sun Feb 20 13:55:07 PST 2011


LTO is working just fine with Firefox right now, except that I cannot
enable debug information.

With debug, linking a single .o into a .so with valgrind shows:

==24373== 36,311,472 bytes in 71,717 blocks are possibly lost in loss
record 1,192 of 1,192
==24373==    at 0x4C2815C: malloc (vg_replace_malloc.c:236)
==24373==    by 0x6CD42C4: llvm::MDNode::getMDNode(llvm::LLVMContext&,
llvm::Value* const*, unsigned int, llvm::MDNode::FunctionLocalness,
bool) (Metadata.cpp:226)

The file itself is 4.5MB, so 36MB from just this allocation spot is a
lot. Having 71,717 blocks also suggests that we should be using some pool.

For now I would be more then happy if I was just able to free that.
lto_module_dispose is being called and the llvm module is being
destructed, but it looks like the only way to free the metadata is to
destroy the LLVMContext. Is this by design? why?

Thanks,
Rafael



More information about the llvm-dev mailing list