TheAssemblyArmada / Thyme

An open source re-implementation of Generals : Zero Hour written in C++.
GNU General Public License v2.0
569 stars 54 forks source link

memory leaks (w3dview) #1132

Open JohnsterID opened 1 month ago

JohnsterID commented 1 month ago

Testing Dr. Memory on w3dview as it is complete. Four detected leaks below and seven possible leaks in the results.

wdump results.txt w3dview results.txt

https://github.com/TheAssemblyArmada/Thyme/blob/d2cb09da8092b567e94165d0e6e72a0da99ef58c/src/tools/w3dviewer/w3dview.cpp#L34

Error #596: LEAK 140 direct bytes 0x045b4150-0x045b41dc + 0 indirect bytes
# 0 replace_operator_new                    [D:\a\drmemory\drmemory\common\alloc_replace.c:2903]
# 1 CW3DViewApp::InitInstance               [D:\a\Thyme\Thyme\src\tools\w3dviewer\w3dview.cpp:34]
# 2 mfc140.dll!?                           +0x0      (0x7495dee0 <mfc140.dll+0x29dee0>)
# 3 KERNEL32.dll!BaseThreadInitThunk

https://github.com/TheAssemblyArmada/Thyme/blob/d2cb09da8092b567e94165d0e6e72a0da99ef58c/src/w3d/renderer/dx8renderer.cpp#L249

Error #602: LEAK 24 direct bytes 0x045dd928-0x045dd940 + 0 indirect bytes
# 0 replace_operator_new                     [D:\a\drmemory\drmemory\common\alloc_replace.c:2903]
# 1 DX8MeshRendererClass::Init               [D:\a\Thyme\Thyme\src\w3d\renderer\dx8renderer.cpp:249]
# 2 W3D::Set_Render_Device                   [D:\a\Thyme\Thyme\src\w3d\renderer\w3d.cpp:248]
# 3 CMainFrame::GetDevice                    [D:\a\Thyme\Thyme\src\tools\w3dviewer\mainfrm.cpp:477]
# 4 CMainFrame::OnCreateClient               [D:\a\Thyme\Thyme\src\tools\w3dviewer\mainfrm.cpp:257]
# 5 mfc140.dll!?                            +0x0      (0x7495709b <mfc140.dll+0x29709b>)
# 6 mfc140.dll!?                            +0x0      (0x74957062 <mfc140.dll+0x297062>)
# 7 CMainFrame::OnCreate                     [D:\a\Thyme\Thyme\src\tools\w3dviewer\mainfrm.cpp:490]
# 8 mfc140.dll!?                            +0x0      (0x74949efa <mfc140.dll+0x289efa>)
# 9 mfc140.dll!?                            +0x0      (0x74949b6d <mfc140.dll+0x289b6d>)
#10 CMainFrame::WindowProc                   [D:\a\Thyme\Thyme\src\tools\w3dviewer\mainfrm.cpp:229]
#11 mfc140.dll!?                            +0x0      (0x74947e24 <mfc140.dll+0x287e24>)

https://github.com/TheAssemblyArmada/Thyme/blob/d2cb09da8092b567e94165d0e6e72a0da99ef58c/src/w3d/renderer/dx8renderer.cpp#L283

Error #608: LEAK 24 direct bytes 0x045e6240-0x045e6258 + 0 indirect bytes
# 0 replace_operator_new                           [D:\a\drmemory\drmemory\common\alloc_replace.c:2903]
# 1 DX8MeshRendererClass::Invalidate               [D:\a\Thyme\Thyme\src\w3d\renderer\dx8renderer.cpp:283]
# 2 W3D::Enable_Sorting                            [D:\a\Thyme\Thyme\src\w3d\renderer\w3d.cpp:417]
# 3 mfc140.dll!?                                  +0x0      (0x7495709b <mfc140.dll+0x29709b>)
# 4 mfc140.dll!?                                  +0x0      (0x74957062 <mfc140.dll+0x297062>)
# 5 CMainFrame::OnCreate                           [D:\a\Thyme\Thyme\src\tools\w3dviewer\mainfrm.cpp:490]
# 6 mfc140.dll!?                                  +0x0      (0x74949efa <mfc140.dll+0x289efa>)
# 7 mfc140.dll!?                                  +0x0      (0x74949b6d <mfc140.dll+0x289b6d>)
# 8 CMainFrame::WindowProc                         [D:\a\Thyme\Thyme\src\tools\w3dviewer\mainfrm.cpp:229]
# 9 mfc140.dll!?                                  +0x0      (0x74947e24 <mfc140.dll+0x287e24>)
#10 mfc140.dll!?                                  +0x0      (0x74948074 <mfc140.dll+0x288074>)
#11 mfc140.dll!?                                  +0x0      (0x74827334 <mfc140.dll+0x167334>)

https://github.com/TheAssemblyArmada/Thyme/blob/d2cb09da8092b567e94165d0e6e72a0da99ef58c/src/tools/w3dviewer/w3dviewdoc.cpp#L264

Error #609: LEAK 240 direct bytes 0x045e63b0-0x045e64a0 + 0 indirect bytes
# 0 replace_operator_new                   [D:\a\drmemory\drmemory\common\alloc_replace.c:2903]
# 1 CW3DViewDoc::Initialize                [D:\a\Thyme\Thyme\src\tools\w3dviewer\w3dviewdoc.cpp:264]
# 2 mfc140.dll!?                          +0x0      (0x7494a0e6 <mfc140.dll+0x28a0e6>)
# 3 mfc140.dll!?                          +0x0      (0x74949b6d <mfc140.dll+0x289b6d>)
# 4 CGraphicView::WindowProc               [D:\a\Thyme\Thyme\src\tools\w3dviewer\graphicview.cpp:102]
# 5 mfc140.dll!?                          +0x0      (0x74947e24 <mfc140.dll+0x287e24>)
# 6 mfc140.dll!?                          +0x0      (0x7494aa15 <mfc140.dll+0x28aa15>)
# 7 mfc140.dll!?                          +0x0      (0x7494aa4d <mfc140.dll+0x28aa4d>)
# 8 mfc140.dll!?                          +0x0      (0x7495737e <mfc140.dll+0x29737e>)
# 9 mfc140.dll!?                          +0x0      (0x748f5c01 <mfc140.dll+0x235c01>)
#10 mfc140.dll!?                          +0x0      (0x748f54a4 <mfc140.dll+0x2354a4>)
#11 mfc140.dll!?                          +0x0      (0x748f4ea3 <mfc140.dll+0x234ea3>)

Edit: I incorrectly added the wdump results instead of w3dview, no issues for wdump. The seven identified possible leaks from w3dview are originating from the d3d8.dll.