Open LinuxRocks2000 opened 2 years ago
For the leaks in olc::Platform_Linux::CreateWindowPane
try changing your olc::Platform_Linux::ApplicationCleanUp
to the following:
virtual olc::rcode ApplicationCleanUp() override
{
XDestroyWindow(olc_Display, olc_Window);
XFree(olc_VisualInfo);
XCloseDisplay(olc_Display);
return olc::rcode::OK;
}
There are some objects allocated a single time in CreateWindowPane
that are never cleaned up. There might be other X objects in there that might need to be cleaned up too; I'm not really an X expert.
The leak of 24648 in olc::PixelGameEngine::olc_ConstructFontSheet
is most likely because fontSprite
and fontDecal
are similarly allocated in the olc_ConstructFontSheet
and never destroyed. If you want, you can delete
those in the appropriate location too.
In regular use I don't think this would result in a growing memory usage though as nothing in your log looks like things that would be created more than once. Unless you're destroying and recreating the PGE object multiple times.
I wrote a simple game with PixelGameEngine a month or so ago, and it works well; it was only today that I discovered it was leaking memory. It's only a little bit and very slow, but it's constant and goes on theoretically forever (I haven't left it running for long enough to know the cap, if one exists). It takes about 5 minutes to go 10 megabytes. Valgrind doesn't report anything helpful.
My operating system is Ubuntu 16 (Zorin OS), and I'm compiling with g++.
EDIT I fiddled with valgrind a bit more and it gave me some useful information, please see the attached text dump.
leak-log-definite.txt