Subject: New Pthread and Cygwin layer issues...
From: "Arash Partow" <[email-masked]>
To: [email-masked]
Cc: [email-masked], [email-masked]
Date: Mon, 10 Nov 2003 07:18:11 +0000

Hi All,

I'm writing about another issue I've found with cygwin layer, pthreads,
memory leaks. I've updated to the lastest g++, currently I'm using
the cygwin1.dll from 8th Nov.

Now the issue is that the ThreadTest (url to source available below) is now
leaking a "HUGE!" amount of memory, and all indications seem to be coming 
from
the cygwin1.dll.

Previous version of the ThreadTest did not include mutexes, so I recently
implemented a simple mutex class to see how it pans out on cygwin.

I think the leak was introduced after the new gcc was put out, because even
the previous version of the ThreadTest that did not test mutexes is leaking
memory now, I think the majority of mem-leak problems came about after the
cygwin1.dll snapshot of the 28th Oct. Previous to that the original Thread
Test was not leaking memory. However now using the new gcc 3.3.1-3 and dlls
of 2nd,3rd,4th,6th,7th and 8th the original ThreadTest leaks memory like
water through a sieve, whats gone wrong ? what has changed so dramatically
in the past 1.5 weeks?

Previous to these snapshots, the ThreadTest was not leaking memory, however
was crashing due to a cygwin layer issue which has now been resolved now.
As before I've carefully tested the same code on BSDs(open and free) and on
RH. I've done check to see if memory leaks occur and also used top to see
if any zombie threads occur. And as before there is no issue with the code.

I've used glowcode and purify to see if I can find where the problem is and
it seems cygwin1.dll is not freeing up handles that it aquires. This leads
to continual usage of virtual memory which leads to more usage of swap,
which inevitably leads to me running out of RAM and swap space, even though
I've got 1024GbRAM and set my swap file 2.5Gb. Using TaskInfo I also see
that the cygwin1.dll is using 387Mb of memory, it gets to this point at
about 250,000 thread creations.

I was wondering if anyone would bother to download the code and see if they
can replicate the same situation, i'd be grateful. Just a reminder same
code has been tested on other *nixs and it seems to be all ok.

url for source code: http://www.partow.net/downloads/ThreadTest.zip

To make type:

make ThreadTest

To run type:

./ThreadTest

If you have any other question or comments please don't hestiste.

Regards

Arash Partow

__________________________________________________
Be one who knows what they don't know,
Instead of being one who knows not what they don't know,
Thinking they know everything about all things.
http://www.partow.net

..

.

_________________________________________________________________
Hot chart ringtones and polyphonics. Go to  
http://ninemsn.com.au/mobilemania/default.asp

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/