[llvm-commits] [PATCH] Fix memory leak in SelectionDAG.cpp

nicolas geoffray nicolas.geoffray at gmail.com
Mon Feb 15 14:54:24 PST 2010


Yes, SelectionDAG::~SelectionDAG() does destroy Ordering, but here it's not
about the destructor, it's about the clear method, which allocates a new
ordering for the DAG without destroying the previous one.

Nicolas

On Mon, Feb 15, 2010 at 11:51 PM, Evan Cheng <evan.cheng at apple.com> wrote:

> Index: lib/CodeGen/SelectionDAG/SelectionDAG.cpp
> ===================================================================
> --- lib/CodeGen/SelectionDAG/SelectionDAG.cpp   (revision 96248)
> +++ lib/CodeGen/SelectionDAG/SelectionDAG.cpp   (working copy)
> @@ -829,6 +829,7 @@
>   EntryNode.UseList = 0;
>   AllNodes.push_back(&EntryNode);
>   Root = getEntryNode();
> +  delete Ordering;
>   Ordering = new SDNodeOrdering();
>  }
>
> Thanks. But this is somewhat surprising. SelectionDAG::~SelectionDAG()
>  does destroy Ordering. I don't understand under what condition this would
> leak memory?
>
> Evan
>
> On Feb 15, 2010, at 2:44 PM, nicolas geoffray wrote:
>
> > Dear all,
> >
> > The following patch fixes a memory leak found by valgrind in
> SelectionDAG.cpp. I am not familiar with the codegen system, so please
> someone comment & apply.
> >
> > Thanks!
> > Nicolas
> > <leak.patch>_______________________________________________
> > llvm-commits mailing list
> > llvm-commits at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20100215/46018593/attachment.html>


More information about the llvm-commits mailing list