Displaying 3 results from an estimated 3 matches for "fillfunct".
2010 Mar 23
3
[LLVMdev] How to avoid memory leaks
...)
Basically I recreate a function over and over again, and pretty sure
that my code doesn't cause the leak
while(true)
{
Function *fn = module->getFunction(name);
if (fn)
fn->eraseFromParent();
fn = cast<Function>(module->getOrInsertFunction(name, fnType));
fillFunction(fn); //Fill function with some blocks and instructions..
}
Is there any documentation guideline on how to manage memory with
LLVM? . I am kind of lost here. I tried anything I could but it seems
the leaks won't go away
Valgrind gives me lots of ..
110,560 bytes in 1,382 blocks are possibl...
2010 Mar 23
0
[LLVMdev] How to avoid memory leaks
...ction *fn = module->getFunction(name);
> if (fn)
> fn->eraseFromParent();
Err, shouldn't you delete fn here? I'm pretty sure that this just
removes the function from the module.
> fn = cast<Function>(module->getOrInsertFunction(name, fnType));
> fillFunction(fn); //Fill function with some blocks and instructions..
> }
Reid
2010 Mar 23
1
[LLVMdev] How to avoid memory leaks
...function from the module.
Doxygen says that:
"eraseFromParent - This method unlinks 'this' from the containing
module and deletes it."
so it should be fine just calling erase.
>
>> fn = cast<Function>(module->getOrInsertFunction(name, fnType));
>> fillFunction(fn); //Fill function with some blocks and instructions..
>> }
>
> Reid
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>...