[LLVMdev] Memory leaks revisited (and many fixed)

Bill Wendling wendling at isanbard.org
Mon Nov 22 07:46:19 PST 2004


Morten Ofstad wrote:
} Chris Lattner wrote:
} >>The four leaks are caused by the ConstantBool::True
} >>and ConstantBool::False (1 for each object + 1 for the use list dummy) -
} >> unfortunately they are not so easy to wrap with accessor functions
} >>since they are public member variables of the ConstantBool class... If
} >>only everyone used the ConstantBool::get() there would be no problem,
} >>but that's not the case. Any suggestions?
} >
} >These should just be destroyed along with the rest of the constants, by
} >Constant::clearAllValueMaps.
} 
} Hmmm, I was planning to call clearAllValueMaps once in a while to clear 
} out the float constants which are building up on me... This shouldn't 
} break anything as it stands, since the constants will be regenerated. 
} However, deleting True and False will cause big problems. I think I'm 
} just going to delete True and False directly from our own shutdown code. 
} That way the leak detector won't complain and I can use 
} clearAllValueMaps as I planned...
} 
Would it work better just to replace all direct references to
"ConstantBool::{True,False}" with the appropriate
"ConstantBool::get({true,false})" and then remove public access to the
variables?

-bw

-- 
||  "Ich kann gar nicht so viel essen, wie ich kotzen möchte"
||      - Max Liebermann, Painter and Designer, 1847-1935, when he saw
||        the SS marching through his street in Berlin the night Hitler
||        got into power.




More information about the llvm-dev mailing list