[LLVMdev] How to avoid memory leaks

Gabi bugspynet at gmail.com
Wed Mar 24 05:54:00 PDT 2010


I have a reason to believe the leak is caused by the way IRBuilder
folds big floats.

In my code I replaced:
   IRBuilder->createFMul(arg1, arg2)
with:
  Instruction *i = BinaryOperator::CreateFMul(arg1, arg2)
  IRBuilder->Insert(i);

And the leak immediately disappeared...

>From my understanding the only difference is that a folding is taking
place by the builder. (I tried to use a builder with "NoFolder" but it
didn't stop the leak)
I  also noted that the leak happens when using lots of FP constants
higher than 100.0 and lots of FMul and FDiv ops

Hope it helps somehow to point to the right direction..


-- 
Regards,
Gabi

http://bugspy.net



More information about the llvm-dev mailing list