New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Memory leak when destructing OpenGLBackend #9028
Comments
On the other hand, the game is exiting. The house is being torn down so why bother washing the floor? |
The "exiting" the game is required as valgrind will only report errors once the application has stopped, so technically it does not tell you whether it leaked at the begin of just before the end. Finally, the code bothers washing the floor; it requests the floor to be washed but then tears down the house before the floor washers can start their work. |
Version of OpenTTD
Anything at or after 436cdf1 (between 1.11.0-beta2 and 1.11.0-RC1)
Expected result
No memory leak (no definitely lost bytes in the leak summary)
Actual result
==27199== 24 bytes in 1 blocks are definitely lost in loss record 383 of 684
==27199== at 0x483877F: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==27199== by 0xAECE1C: unsigned char* MallocT(unsigned long) (alloc_func.hpp:69)
==27199== by 0xAEC4C9: SimpleSpriteAlloc(unsigned long) (spritecache.cpp:819)
==27199== by 0x84FD6B: OpenGLBackend::Encode(SpriteLoader::Sprite const*, void* ()(unsigned long)) (opengl.cpp:1248)
==27199== by 0xAEBB2D: ReadSprite(SpriteCache const, unsigned int, SpriteType, void* ()(unsigned long), SpriteEncoder) (spritecache.cpp:498)
==27199== by 0xAEC7CF: GetRawSprite(unsigned int, SpriteType, void* ()(unsigned long), SpriteEncoder) (spritecache.cpp:904)
==27199== by 0x84F710: OpenGLBackend::PopulateCursorCache() (opengl.cpp:1103)
==27199== by 0x8573C4: VideoDriver_SDL_OpenGL::PopulateSystemSprites() (sdl2_opengl_v.cpp:125)
==27199== by 0x858EBE: VideoDriver::Tick() (video_driver.cpp:175)
==27199== by 0x85605C: VideoDriver_SDL_Base::LoopOnce() (sdl2_v.cpp:642)
==27199== by 0x85609C: VideoDriver_SDL_Base::MainLoop() (sdl2_v.cpp:660)
==27199== by 0xA44F07: openttd_main(int, char**) (openttd.cpp:837)
Steps to reproduce
valgrind ./openttd -d sdl-opengl and then exiting the game.
Starting a game from the main menu doubles the loss and then exiting doubles the loss.
##Notes
#9027 solves some uninitialised memory issues that valgrind complains about.
The mentioned commit tries to fix a threading issue, but breaks this case. However, I am not sure whether calling the actual clearing logic in the destructor is safe for the threading issue solved in that commit.
The text was updated successfully, but these errors were encountered: