What am I doing wrong? (Memory leak and DLL exte)
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=10995
Printed Date: 15 November 2025 at 4:23am Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com
Topic: What am I doing wrong? (Memory leak and DLL exte)
Posted By: JoseAngel
Subject: What am I doing wrong? (Memory leak and DLL exte)
Date Posted: 11 June 2008 at 11:55am
uploads/20080611_115432_extension.zip - uploads/20080611_115432_extension.zip is a small solution with two projects, one extension DLL that exports a very simple MyToolbar class and a MFC client application that uses that dll for to create one toolbar. (The .sln file is in extension directory)
After executing two or three times the application, I can hear a Windows crash sound sound and Visual Studio (2008) show me the next memory leaks information:
Detected memory leaks! Dumping objects -> {473} normal block at 0x00CF6130, 20 bytes long. Data: < > 00 00 00 00 00 00 00 00 00 00 00 00 CD CD CD CD c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\afxtempl.h(401) : {472} normal block at 0x00CF60F0, 4 bytes long. Data: <8 $ > 38 C5 24 00 c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\afxtempl.h(401) : {470} normal block at 0x00CF5F68, 4 bytes long. Data: <8 $ > 38 C5 24 00 c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\afxtempl.h(401) : {467} normal block at 0x00CF5F28, 4 bytes long. Data: < > 00 00 00 00 c:\users\jose angel\documents\visual studio 2008\projects\xtreme toolkitpro v12.0.0\source\commandbars\xtpdockbar.cpp(39) : {466} client block at 0x00CF5E78, subtype c0, 112 bytes long. a CXTPDockBar object at $00CF5E78, 112 bytes long c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\afxtempl.h(401) : {464} normal block at 0x00CF5E38, 4 bytes long. Data: < > 00 00 00 00 c:\users\jose angel\documents\visual studio 2008\projects\xtreme toolkitpro v12.0.0\source\commandbars\xtpdockbar.cpp(39) : {463} client block at 0x00CF5D88, subtype c0, 112 bytes long. a CXTPDockBar object at $00CF5D88, 112 bytes long c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\afxtempl.h(401) : {461} normal block at 0x00CF5D48, 4 bytes long. Data: < > 00 00 00 00 c:\users\jose angel\documents\visual studio 2008\projects\xtreme toolkitpro v12.0.0\source\commandbars\xtpdockbar.cpp(39) : {460} client block at 0x00CF5C98, subtype c0, 112 bytes long. a CXTPDockBar object at $00CF5C98, 112 bytes long c:\users\jose angel\documents\visual studio 2008\projects\xtreme toolkitpro v12.0.0\source\commandbars\xtpdockbar.cpp(39) : {457} client block at 0x00CF5BE8, subtype c0, 112 bytes long. a CXTPDockBar object at $00CF5BE8, 112 bytes long c:\users\jose angel\documents\visual studio 2008\projects\xtreme toolkitpro v12.0.0\source\commandbars\xtpcommandbars.cpp(261) : {455} client block at 0x00CF5AF8, subtype c0, 56 bytes long. a CCmdTarget object at $00CF5AF8, 56 bytes long
|
Replies:
Posted By: Oleg
Date Posted: 11 June 2008 at 1:30pm
|
Hi,
Obviously problem in your Create method.
use
CXTPToolBar * pToolBar = GetCommandBars()->Add("Name", xtpBarTop);
or
CXTPToolBar * pToolBar = GetCommandBars()->Add("Name", xtpBarTop, RUNTIME_CLASS(
CMyToolbar) );
------------- Oleg, Support Team CODEJOCK SOFTWARE SOLUTIONS
|
Posted By: JoseAngel
Date Posted: 12 June 2008 at 7:08am
Or even
myToolbar = new CMyToolbar; myToolbar->Create(GetCommandBars());
Actually my project is bigger and it creates correctly all the objects. Finally I found the source of memory leaks: One of the pluggins of my application are linked with the ANSI version of MFC, and my application is Unicode.
Reading the document: http://support.microsoft.com/kb/167929/en-us/ - http://support.microsoft.com/kb/167929/en-us/ I undertstand now that these memory leaks are false ones.
Thank you.
|
Posted By: Oleg
Date Posted: 13 June 2008 at 6:30am
ok :)
------------- Oleg, Support Team CODEJOCK SOFTWARE SOLUTIONS
|
|