This is the mail archive of the
mailing list for the pthreas-win32 project.
Windows XP memory leak ??? [innocent newbie :)]
- From: "sam copydata" <sam at copydata dot fr>
- To: pthreads-win32 at sourceware dot org
- Date: Wed, 23 Apr 2008 16:51:25 +0200
- Subject: Windows XP memory leak ??? [innocent newbie :)]
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 :
using namespace std;
# define usleep Sleep
# include "crtdbg.h"
# include <Windows.h>
typedef struct toto_s toto_t;
void *testthread(void *a)
test = (toto_t *)a;
cout << "thread créé" << endl;
test->ok = 1;
data = (toto_t *)malloc(sizeof(toto_t));
data->ok = 0;
for (int i = 100000; i; i--)
if (pthread_create(&thread, NULL, testthread, (void *)data))
cout << "erreur : impossible de créer le thread" << endl;
cout << "thread " << 100000 - i << " créé" << endl;
data->ok = 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. :(