Hi
There are many memory leaks at the codes
and there is a line that cause fast memory usage growth that i find it where you set UILable varibles:
label.getComponent().SetLabelText(ss.str(), "arial");
which it call this function everyframe:
void SetLabelText(std::string text, std::string font)
{
SDL_Surface* surf = TTF_RenderText_Blended(Game::assets->GetFont(font), text.c_str(), textColour);
labelTexture = SDL_CreateTextureFromSurface(Game::renderer, surf);
SDL_FreeSurface(surf);
SDL_QueryTexture(labelTexture, nullptr, nullptr, &position.w, &position.h);
}
when i command out the line memory usage remain on 31 mb, but if you let this line run in the program memory usage will increase until it crash.
And I found too many memory leaks with crtdbg.h library that I dump it in a text file:
dump.txt
Hi
There are many memory leaks at the codes
and there is a line that cause fast memory usage growth that i find it where you set UILable varibles:
label.getComponent().SetLabelText(ss.str(), "arial");
which it call this function everyframe:
void SetLabelText(std::string text, std::string font)
{
SDL_Surface* surf = TTF_RenderText_Blended(Game::assets->GetFont(font), text.c_str(), textColour);
labelTexture = SDL_CreateTextureFromSurface(Game::renderer, surf);
SDL_FreeSurface(surf);
SDL_QueryTexture(labelTexture, nullptr, nullptr, &position.w, &position.h);
}
when i command out the line memory usage remain on 31 mb, but if you let this line run in the program memory usage will increase until it crash.
And I found too many memory leaks with crtdbg.h library that I dump it in a text file:
dump.txt