parent
846dfd9bb4
commit
df9ef6fa79
@ -196,8 +196,16 @@ public:
|
|||||||
this->cache[key] = pair.second;
|
this->cache[key] = pair.second;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Free the memory that was allocated too much
|
for( auto it = this->cache.rbegin(); it != this->cache.rend(); it++ ){
|
||||||
this->cache.shrink_to_fit();
|
if( *it != nullptr ){
|
||||||
|
// Resize to only fit all existing non null entries
|
||||||
|
this->cache.resize( this->cache.rend() - it );
|
||||||
|
|
||||||
|
// Free the memory that was allocated too much
|
||||||
|
this->cache.shrink_to_fit();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user