<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="RSS_xslt_style.asp" version="1.0" ?>
<rss version="2.0" xmlns:WebWizForums="https://syndication.webwiz.net/rss_namespace/">
 <channel>
  <title>Codejock Developer Community : CXTPImageManager Memory Leak?</title>
  <link>http://forum.codejock.com/</link>
  <description><![CDATA[This is an XML content feed of; Codejock Developer Community : Command Bars : CXTPImageManager Memory Leak?]]></description>
  <copyright>Copyright (c) 2006-2013 Web Wiz Forums - All Rights Reserved.</copyright>
  <pubDate>Fri, 15 May 2026 17:08:42 +0000</pubDate>
  <lastBuildDate>Wed, 27 Feb 2008 13:36:05 +0000</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Web Wiz Forums 12.04</generator>
  <ttl>360</ttl>
  <WebWizForums:feedURL>forum.codejock.com/RSS_post_feed.asp?TID=9723</WebWizForums:feedURL>
  <image>
   <title><![CDATA[Codejock Developer Community]]></title>
   <url>http://forum.codejock.com/forum_images/codejock-logo.gif</url>
   <link>http://forum.codejock.com/</link>
  </image>
  <item>
   <title><![CDATA[CXTPImageManager Memory Leak? : So I added code to my function...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=9723&amp;PID=31677&amp;title=cxtpimagemanager-memory-leak#31677</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=3787">Danlar</a><br /><strong>Subject:</strong> 9723<br /><strong>Posted:</strong> 27 February 2008 at 1:36pm<br /><br />So I added code to my function above to delete the HBITMAP for each of the icons before removing them...<br /><br /><table width="99%"><tr><td><pre class="BBcode">BOOL success = ::DeleteObject(this-&gt;GetCommandBars()-&gt;GetImageManager()-&gt;GetIconSet(controlID)-&gt;GetIcon(16, FALSE)-&gt;GetIcon().GetBitmap());<br />success = ::DeleteObject(this-&gt;GetCommandBars()-&gt;GetImageManager()-&gt;GetIconSet(controlID)-&gt;GetIcon(32, FALSE)-&gt;GetIcon().GetBitmap());<br />this-&gt;GetCommandBars()-&gt;GetImageManager()-&gt;RemoveIcon(controlID);</pre></td></tr></table><br /><br />DeleteObject returns TRUE each time, indicating it did successfully delete the HBITMAP. <br /><br />This doesn't fix the constantly growing amount of memory though. ]]>
   </description>
   <pubDate>Wed, 27 Feb 2008 13:36:05 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=9723&amp;PID=31677&amp;title=cxtpimagemanager-memory-leak#31677</guid>
  </item> 
  <item>
   <title><![CDATA[CXTPImageManager Memory Leak? : Hi, LoadBitmapFromResource created...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=9723&amp;PID=31672&amp;title=cxtpimagemanager-memory-leak#31672</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=6851">Oleg</a><br /><strong>Subject:</strong> 9723<br /><strong>Posted:</strong> 27 February 2008 at 1:08pm<br /><br />Hi,<DIV>LoadBitmapFromResource created BITMAP that you had to destroy.</DIV>]]>
   </description>
   <pubDate>Wed, 27 Feb 2008 13:08:59 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=9723&amp;PID=31672&amp;title=cxtpimagemanager-memory-leak#31672</guid>
  </item> 
  <item>
   <title><![CDATA[CXTPImageManager Memory Leak? : Well, I fixed it. But, I&amp;#039;m...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=9723&amp;PID=31670&amp;title=cxtpimagemanager-memory-leak#31670</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=3787">Danlar</a><br /><strong>Subject:</strong> 9723<br /><strong>Posted:</strong> 27 February 2008 at 12:47pm<br /><br />Well, I fixed it. But, I'm not sure why or how. It's probably something very simple I've overlooked.<br /><br />If I replace my <font face="Courier New, Courier, mono">SetIcon</font> calls with <font face="Courier New, Courier, mono">SetIcons</font> instead, everything gets better.<br /><br />I changed...<br /><table width="99%"><tr><td><pre class="BBcode">SetIcon(CXTPImageManagerIcon::LoadBitmapFromResource(MAKEINTRESOURCE(icon16), &alpha, controlID, CSize(16, 16), xtpImageNormal)<br /><br /></pre></td></tr></table><br />into...<br /><table width="99%"><tr><td><pre class="BBcode">SetIcons(icon16, &controlID, 1, CSize(16, 16), xtpImageNormal)</pre></td></tr></table><br />and the memory usage has stopped climbing.<br /><br />I've either missed a fundamental feature of <font face="Courier New, Courier, mono">MAKEINTRESOURCE</font> or <font face="Courier New, Courier, mono">LoadBitmapFromResource</font>, or I really don't understand the difference between <font face="Courier New, Courier, mono">SetIcon</font> and <font face="Courier New, Courier, mono">SetIcons</font>.<br /><br />Thanks in advance for any insight.<br /><br />-Dan]]>
   </description>
   <pubDate>Wed, 27 Feb 2008 12:47:24 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=9723&amp;PID=31670&amp;title=cxtpimagemanager-memory-leak#31670</guid>
  </item> 
  <item>
   <title><![CDATA[CXTPImageManager Memory Leak? : I&amp;#039;m executing code which...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=9723&amp;PID=31669&amp;title=cxtpimagemanager-memory-leak#31669</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=3787">Danlar</a><br /><strong>Subject:</strong> 9723<br /><strong>Posted:</strong> 27 February 2008 at 12:26pm<br /><br />I'm executing code which removes icons from the image manager and adds new ones in their place every time a ribbon control gets updated. The memory used by the application climbs very quickly while this happens. Visual Studio doesn't report any memory leaks when the program exits, though, so whatever is allocating all of them is cleaning them up during the exit.<br /><br />Consider this code which sometimes will execute very very frequently:<br /><br /><table width="99%"><tr><td><pre class="BBcode">void CMyXTPFrameWnd::ChangeControlIcon(CXTPControl* control, int icon16, int icon32)<br />{<br />&nbsp;&nbsp;&nbsp;&nbsp;ASSERT(control != NULL);<br />&nbsp;&nbsp;&nbsp;&nbsp;BOOL alpha;<br />&nbsp;&nbsp;&nbsp;&nbsp;int controlID = control-&gt;GetID();<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;this-&gt;GetCommandBars()-&gt;GetImageManager()-&gt;RemoveIcon(controlID);<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;if (icon16 != 0) {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; this-&gt;GetCommandBars()-&gt;GetImageManager()-&gt;SetIcon(CXTPImageManagerIcon::LoadBitmapFromResource(MAKEINTRESOURCE(icon16), &alpha), controlID, CSize(16, 16), xtpImageNormal);<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;if (icon32 != 0 ) {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; this-&gt;GetCommandBars()-&gt;GetImageManager()-&gt;SetIcon(CXTPImageManagerIcon::LoadBitmapFromResource(MAKEINTRESOURCE(icon32), &alpha), controlID, CSize(32, 32), xtpImageNormal);<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;control-&gt;RedrawParent(TRUE);<br />}</pre></td></tr></table><br /><br />When this code is executing, the memory usage by my application climbs very quickly. If I remove the calls to <font face="Courier New, Courier, mono">RemoveIcon</font> and <font face="Courier New, Courier, mono">SetIcon</font>, the memory stops climbing. <br /><br />Any idea what's going on?<br /><br />Before anyone asks, I am certain that <font face="Courier New, Courier, mono">control-&gt;getID()</font> is returning the same value every time this function is getting executed. This rules out the option of constantly removing zero icons and adding two more.<br /><br />Also I've tried throwing <font face="Courier New, Courier, mono">this-&gt;GetCommandBars()-&gt;GetImageManager()-&gt;GetImages()-&gt;GetCount()</font> into the function in various places, and it does decrease in value and re-increase exactly as I'd expect.<br /><br />-Dan]]>
   </description>
   <pubDate>Wed, 27 Feb 2008 12:26:28 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=9723&amp;PID=31669&amp;title=cxtpimagemanager-memory-leak#31669</guid>
  </item> 
 </channel>
</rss>