1
0

fixing memory leak

This commit is contained in:
DayBr3ak 2014-09-02 18:05:53 +02:00
parent ac4ec5117d
commit 29811c4f21

View File

@ -215,7 +215,6 @@ cBioGenMulticache::cBioGenMulticache(cBiomeGen * a_BioGenToCache, int a_CacheSiz
m_CachesLength(a_CachesLength), m_CachesLength(a_CachesLength),
m_InternalCacheLength(a_CachesLength * a_CacheSize) m_InternalCacheLength(a_CachesLength * a_CacheSize)
{ {
//m_Caches = new std::vector<cBiomeGen*>;
m_Caches.reserve(m_InternalCacheLength); m_Caches.reserve(m_InternalCacheLength);
for (int i = 0; i < m_InternalCacheLength; i++) { for (int i = 0; i < m_InternalCacheLength; i++) {
m_Caches.push_back(new cBioGenCache(a_BioGenToCache, a_CacheSize)); m_Caches.push_back(new cBioGenCache(a_BioGenToCache, a_CacheSize));
@ -228,7 +227,10 @@ m_InternalCacheLength(a_CachesLength * a_CacheSize)
cBioGenMulticache::~cBioGenMulticache() cBioGenMulticache::~cBioGenMulticache()
{ {
m_Caches.erase(m_Caches.cbegin(), m_Caches.cend()); for (std::vector<cBiomeGen*>::iterator it = m_Caches.begin(); it != m_Caches.end(); it++)
{
delete *it;
}
} }
@ -249,8 +251,7 @@ void cBioGenMulticache::GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMa
void cBioGenMulticache::InitializeBiomeGen(cIniFile & a_IniFile) void cBioGenMulticache::InitializeBiomeGen(cIniFile & a_IniFile)
{ {
//super::InitializeBiomeGen(a_IniFile); for (std::vector<cBiomeGen*>::iterator it = m_Caches.begin(); it != m_Caches.end(); it++)
for (auto it = m_Caches.begin(); it != m_Caches.end(); it++)
{ {
cBiomeGen * tmp = *it; cBiomeGen * tmp = *it;
tmp->InitializeBiomeGen(a_IniFile); tmp->InitializeBiomeGen(a_IniFile);