1
Graphics / sf::Text::setCharacterSize() memory leak, maybe (Solved)
« on: March 15, 2023, 08:18:48 pm »
I made a gui and I am using a slider to change the font size of a text. The memory remains stable when not changing the value, but every time it's changed it increases memory use. So if I swing the slider back and forth a bit, it eats up my 32GB memory very quickly.
Is it supposed to do this and should I be scaling instead of changing the character size?
Edit: I fixed this issue by using this font function in sf::Text::setCharacterSize()
void Font::clearPages() const
{
// Reset members
m_pages.clear();
std::vector<std::uint8_t>().swap(m_pixelBuffer);
}
Is it supposed to do this and should I be scaling instead of changing the character size?
Edit: I fixed this issue by using this font function in sf::Text::setCharacterSize()
void Font::clearPages() const
{
// Reset members
m_pages.clear();
std::vector<std::uint8_t>().swap(m_pixelBuffer);
}