Skip to content

Too many memory leaks and a line that cause fast memory usage growth #6

Description

@PetrosPastor

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions