[llvm] r234059 - Fixing a memory leak in WinEHPrepare

Kaylor, Andrew andrew.kaylor at intel.com
Fri Apr 3 15:51:55 PDT 2015


Hi David,

After looking into this a little more closely, I see that the other location that calls the function producing the vector involved with this use of DeleteContainerPointers has a much more complicated relationship with the pointers in the vector.  It passes the vector to another function that takes an ArrayRef argument and that function internally moves the pointers into a different container and eventually deletes them.

Obviously this can still be refactored in some way to make it more robust.  It just isn’t obvious to me what the best way to handle it is.  I’m CC’ing David Majnemer who implemented the other code in question (WinEHNumbering::calculateStateNumbers, WinEHNumbering::processCallSite) to see if he has some ideas.

Thanks,
Andy

From: Kaylor, Andrew
Sent: Friday, April 03, 2015 3:06 PM
To: 'David Blaikie'
Cc: llvm-commits at cs.uiuc.edu
Subject: RE: [llvm] r234059 - Fixing a memory leak in WinEHPrepare

Sure, I can do that.

-Andy

From: David Blaikie [mailto:dblaikie at gmail.com]
Sent: Friday, April 03, 2015 3:04 PM
To: Kaylor, Andrew
Cc: llvm-commits at cs.uiuc.edu<mailto:llvm-commits at cs.uiuc.edu>
Subject: Re: [llvm] r234059 - Fixing a memory leak in WinEHPrepare



On Fri, Apr 3, 2015 at 2:44 PM, Andrew Kaylor <andrew.kaylor at intel.com<mailto:andrew.kaylor at intel.com>> wrote:
Author: akaylor
Date: Fri Apr  3 16:44:17 2015
New Revision: 234059

URL: http://llvm.org/viewvc/llvm-project?rev=234059&view=rev
Log:
Fixing a memory leak in WinEHPrepare

Modified:
    llvm/trunk/lib/CodeGen/WinEHPrepare.cpp

Modified: llvm/trunk/lib/CodeGen/WinEHPrepare.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/WinEHPrepare.cpp?rev=234059&r1=234058&r2=234059&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/WinEHPrepare.cpp (original)
+++ llvm/trunk/lib/CodeGen/WinEHPrepare.cpp Fri Apr  3 16:44:17 2015
@@ -733,6 +733,8 @@ void WinEHPrepare::completeNestedLanding
       ActionTargets.push_back(NewBA);
     }
   }
+  DeleteContainerPointers(ActionList);

I've been (vaguely) trying to remove uses of DeleteContainer* functions in favor of unique_ptr - could we change ActionList to be a SmallVector<unique_ptr<ActiovHandler>> instead of raw pointers?

+  ActionList.clear();
   OutlinedBB->getInstList().push_back(EHActions);

   // Insert an indirect branch into the outlined landing pad BB.


_______________________________________________
llvm-commits mailing list
llvm-commits at cs.uiuc.edu<mailto: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/20150403/09790c04/attachment.html>


More information about the llvm-commits mailing list