<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to bugs</title><link>https://sourceforge.net/p/tinythread/bugs/</link><description>Recent changes to bugs</description><atom:link href="https://sourceforge.net/p/tinythread/bugs/feed.rss" rel="self"/><language>en</language><lastBuildDate>Mon, 20 Jun 2011 20:54:50 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/tinythread/bugs/feed.rss" rel="self" type="application/rss+xml"/><item><title>linux and memory leak</title><link>https://sourceforge.net/p/tinythread/bugs/1/</link><description>&lt;div class="markdown_content"&gt;&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;first of all, thanks for the excellent code, I been using it for quite sometime and it has proved to be quite robust on all platforms i tested out with !&lt;/p&gt;
&lt;p&gt;the reason i am writing this bug report is because i think there is a small leak happening on the lines of &lt;a href="http://tread.wordpress.com/2007/02/26/valgrind-and-pthread_create-memory-leak/" rel="nofollow"&gt;http://tread.wordpress.com/2007/02/26/valgrind-and-pthread_create-memory-leak/&lt;/a&gt; . Though i might be totally wrong and not using the library in the correct manner.&lt;/p&gt;
&lt;p&gt;i use the tinythread++ with matlab's c interface and what was happening is after sometime the virtual memory usage got out of hand and the program crashed (what the program did was in a loop start-&amp;gt;spawn number of threads-&amp;gt;stop). after running valgrind, checking via pmap and writing a test case it seems that the something with pthreads was being left on the stack and that caused lots of page faults and thus an increase in virtual memory.&lt;/p&gt;
&lt;p&gt;i guess it has something to do with pthread_exit(NULL) not being in the callee function perhaps?&lt;/p&gt;
&lt;p&gt;attached file compiled as g++ mex_example.cpp tinythread/tinythread.cpp -lpthread&lt;br /&gt;
valgrind check done as   valgrind -v --error-limit=no --tool=memcheck --track-origins=yes --leak-check=full --show-reachable=yes --num-callers=50 ./a.out&lt;/p&gt;
&lt;p&gt;tinythread++ version in matlab after running it for 100 iteration causes a virtual memory size of 77G whereas pthread version doesot leak any memory. BTW same with the c version, if you put a getchar at the end it seems to still increase memory using even when delete is used..&lt;/p&gt;
&lt;p&gt;thanks again.&lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">abi</dc:creator><pubDate>Mon, 20 Jun 2011 20:54:50 -0000</pubDate><guid>https://sourceforge.net9f161d954fa142c502dcc8c43847d586013611ab</guid></item></channel></rss>