<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent changes to bugs</title><link href="https://sourceforge.net/p/tinythread/bugs/" rel="alternate"/><link href="https://sourceforge.net/p/tinythread/bugs/feed.atom" rel="self"/><id>https://sourceforge.net/p/tinythread/bugs/</id><updated>2011-06-20T20:54:50Z</updated><subtitle>Recent changes to bugs</subtitle><entry><title>linux and memory leak</title><link href="https://sourceforge.net/p/tinythread/bugs/1/" rel="alternate"/><published>2011-06-20T20:54:50Z</published><updated>2011-06-20T20:54:50Z</updated><author><name>abi</name><uri>https://sourceforge.net/u/abhirana/</uri></author><id>https://sourceforge.net9f161d954fa142c502dcc8c43847d586013611ab</id><summary type="html">&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;</summary></entry></feed>