X-Recipient: archive-cygwin@delorie.com
X-SWARE-Spam-Status: No, hits=-1.3 required=5.0 	tests=AWL,BAYES_00,SPF_PASS
X-Spam-Check-By: sourceware.org
Content-class: urn:content-classes:message
MIME-Version: 1.0
Content-Type: text/plain; 	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Subject: Is there anyway to reduce cygwin perl's String memory usage?
Date: Wed, 30 Dec 2009 03:13:01 -0500
Message-ID: <FF6036EF5FD259479DEA1D09B2BB485E043027F9@mail1.sangate.com>
From: "Zhao, Dong" <dzhao@sepaton.com>
To: <cygwin@cygwin.com>
Cc: "Zhang, Eric" <ezhang@sepaton.com>
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

Dear All:
Recently our Perl project run into the "Out of memory" issue on Windows Cyg=
win, while it works well on Linux, after optimized the code ,it still didn'=
t work on Windows Cygwin perl(Because we do a lot of analysis bases on stri=
ng arrays and hashes) . We found the reason is Cygwin perl uses much more m=
emory than Linux perl or Windows As perl.
We did a lot searches over the internet but didn't found a solution yet.
I did tune the =A0"heap_chunk_in_mb" flag to "2048" =A0in registry "Softwar=
e/Cygnus Solutions/Cygwin/". But our Perl script still exhausted over 1GB m=
emory and crashes on Cygwin perl.

Then I compared the memory usage difference between Cygwin perl, Windows AS=
 perl, and Linux Perl use this simple script:

=A0=A0=A0 my @array =3D ();
=A0=A0=A0 my $str =3D "A" x 1024;=A0 #A string with 1024 len
=A0=A0=A0 for(my $i=3D0;$i<100*1024;$i++){
=A0=A0=A0=A0=A0=A0=A0 push @array,$str;
=A0=A0=A0 }
=A0=A0=A0 <STDIN>; #No we can take a look at memory.

I expected it to use about 100M memory for all platforms. But Windows cygwi=
n perl use about 200M, while AS perl and Linux perl only used 100M.
Our current cygwin perl version is v5.10.0. And cygwin version is 1.7.1.
I also tried the latest cygwin perl version : v5.10.1. But still the same r=
esult.

Can anyone explain to me?=A0 It there a simple way to reduce the cygwin per=
l's memory usage(Set some flag?Or recomple cygwin perl code)
Thanks for any answer!

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

