From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15031 invoked by alias); 23 Apr 2008 14:51:46 -0000 Received: (qmail 15020 invoked by uid 22791); 23 Apr 2008 14:51:45 -0000 X-Spam-Check-By: sourceware.org Received: from el-out-1112.google.com (HELO el-out-1112.google.com) (209.85.162.182) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 23 Apr 2008 14:51:28 +0000 Received: by el-out-1112.google.com with SMTP id j27so954957elf.23 for ; Wed, 23 Apr 2008 07:51:26 -0700 (PDT) Received: by 10.140.172.19 with SMTP id u19mr606525rve.133.1208962285611; Wed, 23 Apr 2008 07:51:25 -0700 (PDT) Received: by 10.140.225.21 with HTTP; Wed, 23 Apr 2008 07:51:25 -0700 (PDT) Message-ID: <29cb423f0804230751r358ad834l1fd0cfa3322b453d@mail.gmail.com> Date: Wed, 23 Apr 2008 14:51:00 -0000 From: "sam copydata" To: pthreads-win32@sourceware.org Subject: Windows XP memory leak ??? [innocent newbie :)] MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-Google-Sender-Auth: f3ba35d449a336af 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: 2008/txt/msg00018.txt.bz2 Hi, I'm working on a threaded project under Linux & Windows. This project is almost developed under Linux and then ported to windows. When we tried to check memory stability under windows we found some leaks while there was none under Linux. When program runs, it grows up in memory by 4 KB blocks only under windows XP (home or pro version) but it do not moves under windows server 2003 or under Linux. After many tests i isolated this code which reproduce the leak of memory : //////////////////////////////////////////////// main.cpp #include #include using namespace std; #ifdef WIN32 # define usleep Sleep # include "crtdbg.h" # include #endif typedef struct toto_s toto_t; struct toto_s { int ok; }; void *testthread(void *a) { toto_t *test; test =3D (toto_t *)a; cout << "thread cr=E9=E9" << endl; test->ok =3D 1; return NULL; } int main() { pthread_t thread; toto_t *data; data =3D (toto_t *)malloc(sizeof(toto_t)); data->ok =3D 0; for (int i =3D 100000; i; i--) { if (pthread_create(&thread, NULL, testthread, (void *)data)) { cout << "erreur : impossible de cr=E9er le thread" << endl; return -1; } pthread_detach(thread); // testthread(data); cout << "thread " << 100000 - i << " cr=E9=E9" << endl; while (!data->ok) usleep(100); usleep(100); data->ok =3D 0; } free(data); return 0; } //////////////////////////////////////////////// End of main.cpp I compile this code with prebuild version of pthread 2.7.0 or 2.8.0 with the same results. I tried to do it in many other ways always with the same memory leak. If someone have an idea, it would be very welcome, I'm on this since 3 days= . :( --=20 Sam.