From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17411 invoked by alias); 24 Mar 2004 07:05:08 -0000 Mailing-List: contact pthreads-win32-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: pthreads-win32-owner@sources.redhat.com Received: (qmail 17370 invoked from network); 24 Mar 2004 07:05:03 -0000 Received: from unknown (HELO callisto.canberra.edu.au) (137.92.14.50) by sources.redhat.com with SMTP; 24 Mar 2004 07:05:03 -0000 Received: from callisto.canberra.edu.au (nyx.canberra.edu.au [137.92.14.55]) by callisto.canberra.edu.au (8.11.6/8.11.6) with ESMTP id i2O751k12917 for ; Wed, 24 Mar 2004 18:05:01 +1100 Message-ID: <40613372.6000600@callisto.canberra.edu.au> Date: Wed, 24 Mar 2004 07:05:00 -0000 From: Ross Johnson Reply-To: rpj@callisto.canberra.edu.au User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20030225 MIME-Version: 1.0 To: pthreads-win32@sources.redhat.com Subject: Re: memory leak?? References: <759C12D9893C354785F7FFE43B4155000B34F1@omacex06.corp.westworlds.com> <405C09A8.10403@spth.de> In-Reply-To: <405C09A8.10403@spth.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2004/txt/msg00039.txt.bz2 There's nothing that big in the library and no arrays of objects that big etc that I recall. What exactly is included in the size that Task Manager reports? Could it be pages of the DLL itself that have been loaded into memory? The DLL is only 52k and half of it could easily have been loaded after the first pthread_create() call. What happens if you put the getchar() ... getchar() block in a loop - do you get 28k added each time? Ross Philipp Klaus Krause wrote: > Arnett, Don L. schrieb: > >> I'm new to using pthreadsWin32. According to the TaskMgr display >> this program is using about 28K more memory at the second getchar() >> than it was at the first getchar(). I found a couple of discussions >> of memory leaks in the list archives and it usually was a programmer >> problem, but I don't see what I'm missing. Thanks for any input. >> >> #include >> #include >> #include >> >> void *pvDoSomething(void *poThreadArgs); >> >> int main(int argc, char* argv[]) { >> >> pthread_t *poThread; >> >> getchar(); >> >> poThread = (pthread_t*)calloc(1,sizeof(pthread_t)); >> pthread_create(poThread,NULL,pvDoSomething,NULL); >> pthread_detach(*poThread); >> >> free(poThread); >> >> getchar(); >> >> return 0; >> } >> >> void *pvDoSomething(void *poThreadArgs) { >> return NULL; >> } >> >> > The created thread does not necessarily run and exit immidiately. > It might still exist when you reach the second getchar().