Skip to content
Snippets Groups Projects
Commit aca23dea authored by Jonathan Lambrechts's avatar Jonathan Lambrechts
Browse files

functions : remove memory leak

parent 75752d1d
Branches
Tags
No related merge requests found
......@@ -92,8 +92,8 @@ dataCacheDouble &dataCacheMap::substitute(const function *f)
dataCacheMap::~dataCacheMap()
{
for (std::set<dataCacheDouble*>::iterator it = _toDelete.begin();
it!=_toDelete.end(); it++) {
for (std::set<dataCacheDouble*>::iterator it = _allDataCaches.begin();
it!=_allDataCaches.end(); it++) {
delete *it;
}
}
......@@ -309,7 +309,7 @@ class functionLua : public function {
void dataCacheMap::setNbEvaluationPoints(int nbEvaluationPoints) {
_nbEvaluationPoints = nbEvaluationPoints;
for(std::set<dataCacheDouble*>::iterator it = _toResize.begin(); it!= _toResize.end(); it++){
for(std::set<dataCacheDouble*>::iterator it = _allDataCaches.begin(); it!= _allDataCaches.end(); it++){
(*it)->resize();
(*it)->_valid = false;
}
......
......@@ -147,18 +147,14 @@ class dataCacheMap {
std::list<dataCacheMap*> _children;
int _nbEvaluationPoints;
std::map<const function*, dataCacheDouble*> _cacheDoubleMap;
std::set<dataCacheDouble*> _toDelete;
std::set<dataCacheDouble*> _toResize;
std::set<dataCacheDouble*> _allDataCaches;
std::set<dataCacheDouble*> _toInvalidateOnElement;
MElement *_element;
protected:
void addDataCache(dataCacheDouble *data){
_toDelete.insert(data);
}
void addDataCacheDouble(dataCacheDouble *data, bool invalidatedOnElement){
_toResize.insert(data);
_allDataCaches.insert(data);
if(invalidatedOnElement)
_toInvalidateOnElement.insert(data);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment