fix: memory leaks and heavily optimize the game (#117)
* fixed performance issue on getting texture height for rendering the player model as it loades the player texture on every frame * updated the lifetime of the texture * fixed 20 MB memory leak * delay window display until engine init is done
This commit is contained in:
@@ -1256,8 +1256,14 @@ int Textures::getHeight(const wstring& url, int backup)
|
||||
|
||||
if (img)
|
||||
{
|
||||
MemTexture* _texture = new MemTexture();
|
||||
_texture->loadedImage = img;
|
||||
_texture->isLoaded = true;
|
||||
_texture->id = getTexture(_texture->loadedImage, C4JRender::TEXTURE_FORMAT_RxGyBzAw, MIPMAP);
|
||||
|
||||
int h = img->getHeight();
|
||||
delete img;
|
||||
//delete img; // commenting this out and inserting the loaded texture to memTextures unordered_map
|
||||
this->memTextures[url] = _texture;
|
||||
return h;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user