<?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 : Memory Leak on creating threads</title>
  <link>http://forum.codejock.com/</link>
  <description><![CDATA[This is an XML content feed of; Codejock Developer Community : Toolkit Pro : Memory Leak on creating threads]]></description>
  <copyright>Copyright (c) 2006-2013 Web Wiz Forums - All Rights Reserved.</copyright>
  <pubDate>Tue, 07 Apr 2026 15:40:03 +0000</pubDate>
  <lastBuildDate>Thu, 14 Nov 2024 04:07:24 +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=24520</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[Memory Leak on creating threads : Thank you for your response. After...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=24520&amp;PID=79065&amp;title=memory-leak-on-creating-threads#79065</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=9684">Kudo Shinya</a><br /><strong>Subject:</strong> 24520<br /><strong>Posted:</strong> 14 November 2024 at 4:07am<br /><br /><p style="-sizing: border-; margin-top: 0px; margin-bottom: 1rem; color: rgb55, 58, 60; font-family: &quot;Source Sans Pro&quot;, -apple-system, MacSystemFont, &quot;Segoe UI&quot;, Roboto, &quot;Helvetica Neue&quot;, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;; font-size: 14px; : rgba255, 255, 255, 0.85;">Thank you for your response. <br>After further investigation, I was able to resolve the issue myself.</p><ol style="-sizing: border-; padding-left: 2rem; margin-top: 0px; margin-bottom: 1rem; color: rgb55, 58, 60; font-family: &quot;Source Sans Pro&quot;, -apple-system, MacSystemFont, &quot;Segoe UI&quot;, Roboto, &quot;Helvetica Neue&quot;, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;; font-size: 14px; : rgba255, 255, 255, 0.85;"><li style="-sizing: border-;">The memory leak occurs not only with _beginthreadex but also with CreateThread.</li><li style="-sizing: border-;">Calling AfxTermThread() at the end of the created thread resolves the memory leak.</li></ol><p style="-sizing: border-; margin-top: 0px; margin-bottom: 1rem; color: rgb55, 58, 60; font-family: &quot;Source Sans Pro&quot;, -apple-system, MacSystemFont, &quot;Segoe UI&quot;, Roboto, &quot;Helvetica Neue&quot;, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;; font-size: 14px; : rgba255, 255, 255, 0.85;">By calling AfxTermThread() at the end of threads created with _beginthreadex and CreateThread, I was able to solve the problem.</p><p style="-sizing: border-; margin-top: 0px; margin-bottom: 1rem; color: rgb55, 58, 60; font-family: &quot;Source Sans Pro&quot;, -apple-system, MacSystemFont, &quot;Segoe UI&quot;, Roboto, &quot;Helvetica Neue&quot;, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;; font-size: 14px; : rgba255, 255, 255, 0.85;">Thank you.<br><br></p>]]>
   </description>
   <pubDate>Thu, 14 Nov 2024 04:07:24 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=24520&amp;PID=79065&amp;title=memory-leak-on-creating-threads#79065</guid>
  </item> 
  <item>
   <title><![CDATA[Memory Leak on creating threads : Hello Shinya,Unfortunately it...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=24520&amp;PID=79061&amp;title=memory-leak-on-creating-threads#79061</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=9012">agontarenko</a><br /><strong>Subject:</strong> 24520<br /><strong>Posted:</strong> 14 November 2024 at 2:45am<br /><br />Hello Shinya,<br><br>Unfortunately it is not clear what exactly is going wrong. Can you please provide more detailed information. <br>If it cannot be re-produced in any of our sample applications provided <br>I would appreciate you sending a sample application so that we could debug it.<br><br>Regards,<br>Artem Gontarenko]]>
   </description>
   <pubDate>Thu, 14 Nov 2024 02:45:47 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=24520&amp;PID=79061&amp;title=memory-leak-on-creating-threads#79061</guid>
  </item> 
  <item>
   <title><![CDATA[Memory Leak on creating threads : CJ:v22.0.0VisualStudio: 2022 (17.11.5)Windows:...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=24520&amp;PID=79055&amp;title=memory-leak-on-creating-threads#79055</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=9684">Kudo Shinya</a><br /><strong>Subject:</strong> 24520<br /><strong>Posted:</strong> 11 November 2024 at 2:11am<br /><br />CJ:&nbsp;v22.0.0<div>VisualStudio: 2022 (17.11.5)</div><div>Windows: 11</div><div><br></div><div><div>I am creating numerous worker threads using _beginthreadex and terminating them with _endthreadex(0) and CloseHandle().</div><div><br></div><div>When taking a memory snapshot in Visual Studio, a memory leak of 480 bytes per thread occurs at&nbsp;</div><div>MyApp.exe!_AFX_THREAD_STATE.</div><div><br></div><div>The call stack is as follows, confirming that the memory was allocated by the Toolkit during thread creation:&nbsp;</div><div>kernel32.dll!0x7ff96021257d()&nbsp;</div><div>MyApp.exe!CXTPSkinManagerDetoursApiHook::ThreadProcHook() - Line 591&nbsp;</div><div>MyApp.exe!AfxGetModuleState() - Line 314&nbsp;</div><div>MyApp.exe!CThreadLocal&lt;_AFX_THREAD_STATE&gt;CreateObject() - Line 200&nbsp;</div><div>MyApp.exe!CThreadLocalObjectGetData() - Line 453&nbsp;</div><div>MyApp.exe!CThreadLocal&lt;_AFX_THREAD_STATE&gt;::GetData() - Line 179&nbsp;</div><div>MyApp.exe!CThreadLocal&lt;_AFX_THREAD_STATE&gt;::operator _AFX_THREAD_STATE *() - Line 191</div><div><br></div><div>It seems that using AfxBeginThread instead of _beginthreadex can avoid this issue</div><div><br></div><div>My application creates and deletes a very large number of threads, so I cannot overlook this small memory leak.&nbsp;</div><div>Additionally, the libraries my application depends on also seem to create threads, making it impossible to replace all thread creation with AfxBeginThread.</div><div><br></div><div>Is there any workaround for this issue?</div><div><br></div></div><div>Regars,</div><div>Shinya</div>]]>
   </description>
   <pubDate>Mon, 11 Nov 2024 02:11:38 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=24520&amp;PID=79055&amp;title=memory-leak-on-creating-threads#79055</guid>
  </item> 
 </channel>
</rss>