Print Page | Close Window

BUG: Memory leak in skin framework

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=24167
Printed Date: 22 December 2024 at 12:27pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: BUG: Memory leak in skin framework
Posted By: mgampi
Subject: BUG: Memory leak in skin framework
Date Posted: 11 June 2021 at 1:05pm
Hi;

I use toolkit 19.3 and I can always reproduce memory leaks in skin framework.
See the call stack:

>    ucrtbased.dll!heap_alloc_dbg_internal(const unsigned int size, const int block_use, const char * const file_name, const int line_number) Zeile 319    C++
     ucrtbased.dll!heap_alloc_dbg(const unsigned int size, const int block_use, const char * const file_name, const int line_number) Zeile 450    C++
     ucrtbased.dll!_malloc_dbg(unsigned int size, int block_use, const char * file_name, int line_number) Zeile 495    C++
     mfc140ud.dll!operator new(unsigned int nSize, int nType, const char * lpszFileName, int nLine) Zeile 354    C++
     mfc140ud.dll!operator new[](unsigned int nSize, int nType, const char * lpszFileName, int nLine) Zeile 386    C++
     mfc140ud.dll!operator new[](unsigned int nSize, const char * lpszFileName, int nLine) Zeile 48    C++
     mfc140ud.dll!CPlex::Create(CPlex * & pHead, unsigned int nMax, unsigned int cbElement) Zeile 29    C++
     ToolkitPro1930vc150UD.dll!CMap<CXTPRWCriticalSection const *,CXTPRWCriticalSection const *,long,long>::NewAssoc(const CXTPRWCriticalSection * key) Zeile 1484    C++
     ToolkitPro1930vc150UD.dll!CMap<CXTPRWCriticalSection const *,CXTPRWCriticalSection const *,long,long>::operator[](const CXTPRWCriticalSection * key) Zeile 1597    C++
     ToolkitPro1930vc150UD.dll!CXTPRWCriticalSection::IncrementLocalSharedLockCounter() Zeile 317    C++
     ToolkitPro1930vc150UD.dll!CXTPRWCriticalSection::LockShared(int bPopMode) Zeile 282    C++
     ToolkitPro1930vc150UD.dll!CXTPRWCriticalSection::LockShared() Zeile 170    C++
     ToolkitPro1930vc150UD.dll!CXTPRWCriticalSection::CSharedLock::CSharedLock(CXTPRWCriticalSection & cs) Zeile 304    C++
     ToolkitPro1930vc150UD.dll!CXTPAsyncGuard<CXTPSkinManager,CXTPRWCriticalSection::CSharedLock>::CXTPAsyncGuard<CXTPSkinManager,CXTPRWCriticalSection::CSharedLock>(CXTPSkinManager & adaptee, CXTPRWCriticalSection & cs) Zeile 430    C++
     ToolkitPro1930vc150UD.dll!XTPAccessShared<CXTPSkinManager>(CXTPSkinManager * pObject) Zeile 638    C++
     ToolkitPro1930vc150UD.dll!CXTPSkinManagerApiHookBase::CallHookDefWindowProc(HWND__ * hWnd, void * pfnOrig, XTPSkinDefaultProc defProc, void * lpPrev, unsigned int nMessage, unsigned int & wParam, long & lParam, long & lResult) Zeile 222    C++
     ToolkitPro1930vc150UD.dll!CXTPSkinManagerDetoursApiHook::OnHookCallWindowProcW(long(__stdcall*)(HWND__ *, unsigned int, unsigned int, long) lpPrevWndFunc, HWND__ * hWnd, unsigned int Msg, unsigned int wParam, long lParam) Zeile 899    C++
     mfc140ud.dll!CWnd::DefWindowProcW(unsigned int nMsg, unsigned int wParam, long lParam) Zeile 1100    C++
     mfc140ud.dll!CWnd::WindowProc(unsigned int message, unsigned int wParam, long lParam) Zeile 2100    C++
     ToolkitPro1930vc150UD.dll!CXTPTabClientWnd::WindowProc(unsigned int message, unsigned int wParam, long lParam) Zeile 2407    C++
     mfc140ud.dll!AfxCallWndProc(CWnd * pWnd, HWND__ * hWnd, unsigned int nMsg, unsigned int wParam, long lParam) Zeile 265    C++
     mfc140ud.dll!AfxWndProc(HWND__ * hWnd, unsigned int nMsg, unsigned int wParam, long lParam) Zeile 418    C++
     mfc140ud.dll!AfxWndProcBase(HWND__ * hWnd, unsigned int nMsg, unsigned int wParam, long lParam) Zeile 299    C++
     user32.dll!__InternalCallWinProc@20()    Unbekannt
     user32.dll!UserCallWinProcCheckWow()    Unbekannt
     user32.dll!DispatchClientMessage()    Unbekannt
     user32.dll!___fnOPTOUTLPDWORDOPTOUTLPDWORD@4()    Unbekannt
     ntdll.dll!_KiUserCallbackDispatcher@12()    Unbekannt
     user32.dll!SendMessageW()    Unbekannt
     mfc140ud.dll!CMDIFrameWnd::MDIGetActive(int * pbMaximized) Zeile 320    C++
     mfc140ud.dll!CMDIFrameWnd::OnCmdMsg(unsigned int nID, int nCode, void * pExtra, AFX_CMDHANDLERINFO * pHandlerInfo) Zeile 67    C++
     ToolkitPro1930vc150UD.dll!CXTPMDIFrameWnd::OnCmdMsg(unsigned int nID, int nCode, void * pExtra, AFX_CMDHANDLERINFO * pHandlerInfo) Zeile 98    C++
     XRVisualizer.exe!CMainFrame::OnCmdMsg(unsigned int nID, int nCode, void * pExtra, AFX_CMDHANDLERINFO * pHandlerInfo) Zeile 1629    C++
     mfc140ud.dll!CCmdUI::DoUpdate(CCmdTarget * pTarget, int bDisableIfNoHndler) Zeile 764    C++
     ToolkitPro1930vc150UD.dll!CXTPCommandBar::CCommandBarCmdUI::DoUpdate(CCmdTarget * pTarget, int bDisableIfNoHandler) Zeile 745    C++
     ToolkitPro1930vc150UD.dll!CXTPCommandBar::OnUpdateCmdUI() Zeile 872    C++
     ToolkitPro1930vc150UD.dll!CXTPCommandBar::OnIdleUpdateCmdUI(unsigned int __formal, long __formal) Zeile 670    C++
     mfc140ud.dll!CWnd::OnWndMsg(unsigned int message, unsigned int wParam, long lParam, long * pResult) Zeile 2441    C++
     ToolkitPro1930vc150UD.dll!CXTPCommandBar::OnWndMsg(unsigned int message, unsigned int wParam, long lParam, long * pResult) Zeile 2635    C++
     mfc140ud.dll!CWnd::WindowProc(unsigned int message, unsigned int wParam, long lParam) Zeile 2099    C++
     mfc140ud.dll!AfxCallWndProc(CWnd * pWnd, HWND__ * hWnd, unsigned int nMsg, unsigned int wParam, long lParam) Zeile 265    C++
     mfc140ud.dll!CWnd::SendMessageToDescendants(HWND__ * hWnd, unsigned int message, unsigned int wParam, long lParam, int bDeep, int bOnlyPerm) Zeile 3025    C++
     mfc140ud.dll!CWnd::SendMessageToDescendants(HWND__ * hWnd, unsigned int message, unsigned int wParam, long lParam, int bDeep, int bOnlyPerm) Zeile 3036    C++
     mfc140ud.dll!CWnd::SendMessageToDescendants(unsigned int message, unsigned int wParam, long lParam, int bDeep, int bOnlyPerm) Zeile 130    C++
     mfc140ud.dll!CWinThread::OnIdle(long lCount) Zeile 680    C++
     mfc140ud.dll!CWinApp::OnIdle(long lCount) Zeile 1050    C++
     XRVisualizer.exe!CXRVisualizerApp::OnIdle(long lCount) Zeile 3309    C++
     mfc140ud.dll!CWinThread::Run() Zeile 621    C++
     mfc140ud.dll!CWinApp::Run() Zeile 787    C++
     XRVisualizer.exe!AfxWinMain(HINSTANCE__ * hInstance, HINSTANCE__ * hPrevInstance, wchar_t * lpCmdLine, int nCmdShow) Zeile 101    C++
     XRVisualizer.exe!wWinMain(HINSTANCE__ * hInstance, HINSTANCE__ * hPrevInstance, wchar_t * lpCmdLine, int nCmdShow) Zeile 26    C++
     XRVisualizer.exe!invoke_main() Zeile 123    C++
     XRVisualizer.exe!__scrt_common_main_seh() Zeile 288    C++
     XRVisualizer.exe!__scrt_common_main() Zeile 331    C++
     XRVisualizer.exe!wWinMainCRTStartup() Zeile 17    C++
     kernel32.dll!@BaseThreadInitThunk@12()    Unbekannt
     ntdll.dll!__RtlUserThreadStart()    Unbekannt
     ntdll.dll!__RtlUserThreadStart@8()    Unbekannt

How can we solve this? What leads to this memory leak. The longer the app is executed the higher the leaked memory.


-------------
Martin

Product: Xtreme Toolkit v 22.1.0, new Projects v 24.0.0
Platform: Windows 10 v 22H2 (64bit)
Language: VC++ 2022



Replies:
Posted By: astoyan
Date Posted: 15 June 2021 at 5:45pm
Hi, it looks the bug is specific to your use case or environment, at least in ToolkitPro samples it does not happen, however we've added extra diagnostic to v20 that will try to catch all unreleased references in debug configurations. If it's possible, you can create submit a sample project as a support ticket to have it debugged.


Posted By: mgampi
Date Posted: 16 June 2021 at 2:09am
We have created several applications that are skinned and all of them show the same memory leaks when profiled with Memory Validator or the integrated VC++ IDE leak detection.
I'm convinced that it's not our bug.
We use the skin framework as shown in the samples - nothing special.


-------------
Martin

Product: Xtreme Toolkit v 22.1.0, new Projects v 24.0.0
Platform: Windows 10 v 22H2 (64bit)
Language: VC++ 2022


Posted By: astoyan
Date Posted: 18 June 2021 at 11:07pm
Can you confirm that those leaks are detected on application shutdown after application object destructor is called? I can see that VC++ memory profiler registers those allocations between snapshots but eventually when application is closing all the memory is released, and those are really small chunks of memory which most likely won't have any impact.

In case we're talking about different issues please show the actual numbers, i.e. the amount of memory leaked per certain time to see the real scale of the problem.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net