From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7126 invoked by alias); 2 Dec 2011 14:10:02 -0000 Received: (qmail 7063 invoked by uid 22791); 2 Dec 2011 14:09:59 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from flexo.grapevine.net.au (HELO flexo.grapevine.net.au) (203.129.32.140) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 02 Dec 2011 14:09:40 +0000 Received: from localhost (localhost [127.0.0.1]) by flexo.grapevine.net.au (Postfix) with ESMTP id 6965B583F86; Sat, 3 Dec 2011 01:09:38 +1100 (EST) Received: from flexo.grapevine.net.au ([127.0.0.1]) by localhost (flexo.grapevine.net.au [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id fX5mJciPIMoW; Sat, 3 Dec 2011 01:09:38 +1100 (EST) Received: from [192.168.2.2] (ppp-38-248.grapevine.net.au [203.129.38.248]) (Authenticated sender: Ross.Johnson@homemail.com.au) by flexo.grapevine.net.au (Postfix) with ESMTPA id 2A948583F66; Sat, 3 Dec 2011 01:09:38 +1100 (EST) Message-ID: <4ED8DBBB.4060302@homemail.com.au> Date: Fri, 02 Dec 2011 14:10:00 -0000 From: Ross Johnson User-Agent: Mozilla/5.0 (Windows NT 6.0; rv:8.0) Gecko/20111105 Thunderbird/8.0 MIME-Version: 1.0 To: Jason Jones CC: pthreads-win32@sourceware.org Subject: Re: Possible memory leak in Pthreads-Win32 References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact pthreads-win32-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: pthreads-win32-owner@sourceware.org X-SW-Source: 2011/txt/msg00033.txt.bz2 Hi Jason, I ran your test with the pthreadVC2.dll that I've just built from the sources from the current cvs head and did not see any resources growing over time, including memory, handles, etc. Peak working set was about 1.6MB and Working Set (Private) was about 550kB toggling between a max and min value with small delta but not growing at all. The particulars for this test were: - current cvs head revision of the code - Windows Vista 32 bit - MSVS 2010 Express compiler (32 bit) - pthreadVC2.dll built by runing "nmake clean VC-inlined" - test suite passed by running "nmake clean VC" in the tests folder - your test compiled by running "nmake pthread_leak-1.exe" in the tests folder (only succeeds if run after running the test suite so that the required headers and libs are copied into the tests folder). I also compiled your test using the command line in your comments (modified to run relative to the tests folder), i.e. without all the additional flags from the nmake build, and no leak there either but did consume slightly more memory. You didn't indicate what version of the library you are using (pre-built or built from source) or any other details of your system but I'm reasonably confident there aren't any leaks with the current cvs head source revision. Regards. Ross On 2/12/2011 1:11 PM, Jason Jones wrote: > Hello! > > I am having memory leaks when using Pthreads-Win32. I have attached a > very simple example program that illustrates the problem. It is very > simple: > > 1) Inside a for loop, I create two threads with pthread_create. > 2) Each of these threads executes a function that just returns 0; > 3) I print out the return from the pthread_create calls. > 4) Then use pthread_join on the two threads and the execute the next > iteration of the loop. > > As I run this program, I can watch the memory constantly growing ( > through task manager ). If I let it run long enough, I have seen it > use 600 megabytes of memory. If I run the same program on Linux with > native pthreads, I do not see any memory growth no matter how long I > let it run. On Windows I see the memory leak with Visual Studio 2008 > and also with the latest version of the Intel compiler. > > Is this a memory leak? Or am I doing something stupid? > > Thanks, > > Jason