X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=BAYES_00,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org MIME-Version: 1.0 In-Reply-To: References: Date: Thu, 31 Dec 2009 11:36:59 +0000 Message-ID: <6910a60912310336v6a7edbeeuc3b5a33889e7e1fa@mail.gmail.com> Subject: Re: Is there anyway to reduce cygwin perl's String memory usage? From: Reini Urban To: cygwin AT cygwin DOT com Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com 2009/12/30 Zhao, Dong: > Dear All: > Recently our Perl project run into the "Out of memory" issue on Windows C= ygwin, while it works well on Linux, after optimized the code ,it still did= n't work on Windows Cygwin perl(Because we do a lot of analysis bases on st= ring arrays and hashes) . We found the reason is Cygwin perl uses much more= memory 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 "Softw= are/Cygnus Solutions/Cygwin/". But our Perl script still exhausted over 1GB= memory 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 ; #No we can take a look at memory. > > I expected it to use about 100M memory for all platforms. But Windows cyg= win 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= result. > > Can anyone explain to me?=A0 It there a simple way to reduce the cygwin p= erl's memory usage(Set some flag?Or recomple cygwin perl code) > Thanks for any answer! I 'll investigate. Best is always to pre-allocate huge memory to help those malloc calls. We are using the standard perl malloc -Dusemymalloc=3Dy (hints/cygwin.sh) Maybe the other platforms are using their system malloc. You can override that with -Dusemymalloc=3Dn ../perl-5.10.1/Configure -de -Dlibperl=3Dcygperl5_10_sysmalloc.dll -Dmksymlinks -Dusethreads -Dmad=3Dy -Dusemymalloc=3Dn (untested) --=20 Reini Urban http://phpwiki.org/ http://murbreak.at/ -- 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