[LLVMdev] LLVM and memory leaks

Morten Ofstad morten at hue.no
Fri Nov 19 02:58:32 PST 2004


Chris Lattner wrote:
> Ok, here's some feedback.  This patch looks like a combination of several
> different things.  If you resubmit the patch in pieces, we can get the
> undebatable ones applied first:
> 
> 2. The clearAllValueMaps related changes.  These are also fine, but please
>    make clearAllValueMaps be a static function in the Constant class,
>    Constant::ClearAllValueMaps().
> 4. The Types change, including the vector.  As you guessed, I'm not a fan
>    of this at all: it adds overhead to the normal case.  Don't the *Types
>    maps contain all of the information that you need to do the clearing?
>    In clearAllTypeMaps (which should become a static method in Type,
>    allowing you to avoid the friend issues), as a first pass, can't you
>    loop over FunctionTypes, PointerTypes, etc and build the vector there?

I have redone the implementation of clearAllValueMaps and 
clearAllTypeMaps so they are now static member functions of Constant and 
Type respectively. I've implemented both in exactly the same way now, 
first clear the maps and put the Types/Constants in a vector, then drop 
references, then delete the Types/Constants and finally clear the 
vector. I don't think it is possible to implement it any cleaner than 
this, so I hope you will take the patch now ^^

m.

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: clear.patch.txt
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20041119/f530edab/attachment.txt>


More information about the llvm-dev mailing list