[31997] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 3261 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jan 20 14:09:28 2011

Date: Thu, 20 Jan 2011 11:09:11 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 20 Jan 2011     Volume: 11 Number: 3261

Today's topics:
    Re: Memory limit question sln@netherlands.com
    Re: Memory limit question sln@netherlands.com
    Re: Memory limit question <hjp-usenet2@hjp.at>
    Re: Memory limit question <edgrsprj@ix.netcom.com>
    Re: Memory limit question <edgrsprj@ix.netcom.com>
        one regex to do the work of two? <spydox@gmail.com>
    Re: one regex to do the work of two? <spydox@gmail.com>
    Re: one regex to do the work of two? (Randal L. Schwartz)
    Re: one regex to do the work of two? <tadmc@seesig.invalid>
    Re: one regex to do the work of two? <jurgenex@hotmail.com>
    Re: one regex to do the work of two? <jwkrahn@example.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Tue, 18 Jan 2011 11:21:49 -0800
From: sln@netherlands.com
Subject: Re: Memory limit question
Message-Id: <ivpbj69e36ikrrk7l0912uoaoigm2pjpbn@4ax.com>

On Tue, 18 Jan 2011 10:17:43 -0800, sln@netherlands.com wrote:

>On Mon, 17 Jan 2011 18:27:06 -0600, "E.D.G." <edgrsprj@ix.netcom.com> wrote:
>
>>The ActiveState version of Perl is being used with Windows XP and Vista on 
>>standard PC computers.
>>
>>QUESTION:  Does Perl have a limit on how much memory it can use with Windows 
>>XP and Vista?
>>
[snip]

>You answered the question yourself. Windows tries to keep everything in ram
>if possible. When you allocate large chunks of memory, the available memory goes
>down, but the system cache goes down too, trying to free up ram for the available
>memory.
>
[snip]

Cancel answer, this appears not to be entirely the case.


------------------------------

Date: Tue, 18 Jan 2011 11:31:17 -0800
From: sln@netherlands.com
Subject: Re: Memory limit question
Message-Id: <m2qbj611nletsdv6f20msivlbtnji9ff12@4ax.com>

On Mon, 17 Jan 2011 18:27:06 -0600, "E.D.G." <edgrsprj@ix.netcom.com> wrote:

>The ActiveState version of Perl is being used with Windows XP and Vista on 
>standard PC computers.
>
>QUESTION:  Does Perl have a limit on how much memory it can use with Windows 
>XP and Vista?
>
>BACKGROUND:  One of my computer programs running on a Vista system with 4 
>gigabytes of memory can be instructed to process different amounts of data 
>and store them in arrays while it is running.  And when it is set to process 
>too much information either the program or Windows generates an "Out of 
>Memory" error even though all of the free Ram memory has not been used.  And 
>the program crashes.
>
>       However, several copies of the program can be run at the same time if 
>each is set to process smaller amounts of data.  When Windows runs out of 
>Ram memory it starts using Virtual Memory.  And the programs keep running, 
>though as expected, they run at greatly reduced speed.
>
>       Is that Out of Memory error a memory usage limitation that is built 
>into Perl?  Or is something else causing the program to crash when it is 
>asked to process too much information?
>
>      That question is important to the use of the Perl program because I am 
>considering having a customized computer built that could have as much as 32 
>gigabytes of memory.  And if the Perl program will crash whenever it tries 
>to use more than about 1.5 gigabytes of memory then its structure will 
>probably have to be changed so that more than one copy can be run at the 
>same time.  They will then work together to process the required amounts of 
>data.

I have just checked this myself and found this to be the case.
I can start a perl process that uses half of physical ram.
Start another perl process that uses half (the same program actually) of ram.

Interesting, the other one process will page almost entirely to disk.
When I keep allocating in the foreground process, no matter what, it will
'out of memory' (note a Perl message) when the allocation goes over the size
of physical memory (installed).

No system message comes up. This could be a Perl thing. Some older programs
actually check available physical ram and won't try to allocate if
over that limit - a safety thing?. But then again, it could be a FEATURE
of windows and M$.

-sln


------------------------------

Date: Tue, 18 Jan 2011 23:21:05 +0100
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: Memory limit question
Message-Id: <slrnijc4ih.k4u.hjp-usenet2@hrunkner.hjp.at>

On 2011-01-18 00:27, E.D.G. <edgrsprj@ix.netcom.com> wrote:
> The ActiveState version of Perl is being used with Windows XP and Vista on 
> standard PC computers.
>
> QUESTION:  Does Perl have a limit on how much memory it can use with Windows 
> XP and Vista?

32 bit or 64 bit Windows?


> BACKGROUND:  One of my computer programs running on a Vista system with 4 
> gigabytes of memory can be instructed to process different amounts of data 
> and store them in arrays while it is running.  And when it is set to process 
> too much information either the program or Windows generates an "Out of 
> Memory" error even though all of the free Ram memory has not been used.  And 
> the program crashes.
>
>        However, several copies of the program can be run at the same time if 
> each is set to process smaller amounts of data.  When Windows runs out of 
> Ram memory it starts using Virtual Memory.  And the programs keep running, 
> though as expected, they run at greatly reduced speed.
>
>        Is that Out of Memory error a memory usage limitation that is built 
> into Perl?

32 Bit Windows has a 2 GB limit per process.


>       That question is important to the use of the Perl program because I am 
> considering having a customized computer built that could have as much as 32 
> gigabytes of memory.

Then you will want to install a 64 bit OS on it.

	hp



------------------------------

Date: Thu, 20 Jan 2011 12:26:12 -0600
From: "E.D.G." <edgrsprj@ix.netcom.com>
Subject: Re: Memory limit question
Message-Id: <Ae2dncTqD4Pa46XQnZ2dnUVZ_tGdnZ2d@earthlink.com>

"Peter J. Holzer" <hjp-usenet2@hjp.at> wrote in message 
news:slrnijc4ih.k4u.hjp-usenet2@hrunkner.hjp.at...
> On 2011-01-18 00:27, E.D.G. <edgrsprj@ix.netcom.com> wrote:
>> The ActiveState version of Perl is being used with Windows XP and Vista 
>> on
>> standard PC computers.
>>
>> QUESTION:  Does Perl have a limit on how much memory it can use with 
>> Windows
>> XP and Vista?
>
> 32 bit or 64 bit Windows?

> 32 Bit Windows has a 2 GB limit per process.

Thanks for the comments.

I am presently using 32 bit windows.  The new machine will likely have the 
64 bit system.

It sounds as if it would probably be impossible to change some Windows 
parameter so that a larger size program could run.  So, for the moment I am 
going to plan on having to run multiple programs if the present Vista 
computer is used.  If the 64 bit system will run larger programs then 
perhaps a single program can be used on the new system.

As it is somewhat uncertain regarding what results will be obtained here 
some additional checking will be done before the new computer is built.



------------------------------

Date: Thu, 20 Jan 2011 12:32:24 -0600
From: "E.D.G." <edgrsprj@ix.netcom.com>
Subject: Re: Memory limit question
Message-Id: <dMmdnaam39wk4qXQnZ2dnUVZ_v-dnZ2d@earthlink.com>

<sln@netherlands.com> wrote in message 
news:m2qbj611nletsdv6f20msivlbtnji9ff12@4ax.com...
> On Mon, 17 Jan 2011 18:27:06 -0600, "E.D.G." <edgrsprj@ix.netcom.com> 
> wrote:
>
>>The ActiveState version of Perl is being used with Windows XP and Vista on
>>standard PC computers.
>>
>>QUESTION:  Does Perl have a limit on how much memory it can use with 
>>Windows
>>XP and Vista?
>>

> I have just checked this myself and found this to be the case.
> I can start a perl process that uses half of physical ram.
> Start another perl process that uses half (the same program actually) of 
> ram.
>
> Interesting, the other one process will page almost entirely to disk.
> When I keep allocating in the foreground process, no matter what, it will
> 'out of memory' (note a Perl message) when the allocation goes over the 
> size
> of physical memory (installed).
>
> No system message comes up. This could be a Perl thing. Some older 
> programs
> actually check available physical ram and won't try to allocate if
> over that limit - a safety thing?. But then again, it could be a FEATURE
> of windows and M$.

Thanks for the comments.  Some additional tests and checks are going to have 
to be run on this.  But it sounds from another responder's note that my 32 
bit Windows will allow only 2 gigabytes for a given application.  So 
increasing the memory size of the computer itself would not solve the 
problem.

And, the answer to my original question might then be that Perl itself is 
not limiting the size of memory that can be used but rather the Windows 
system.



------------------------------

Date: Wed, 19 Jan 2011 10:24:52 -0800 (PST)
From: Spydo <spydox@gmail.com>
Subject: one regex to do the work of two?
Message-Id: <55b59fa1-d958-4b82-97b0-eb6221c72cb8@r19g2000prm.googlegroups.com>

I frequently have to clean up lines with:

s/^\s+//;
s/\s+$//;

Is there ONE regex (as in ONE, SINGLE s///, not one compound
statement) that can do both of these ?

Thanks & happy Gnu Year.


------------------------------

Date: Wed, 19 Jan 2011 10:28:17 -0800 (PST)
From: Spydo <spydox@gmail.com>
Subject: Re: one regex to do the work of two?
Message-Id: <a2597a07-fbd8-4839-a529-f78a160aeee4@u3g2000vbj.googlegroups.com>

On Jan 19, 1:24=A0pm, Spydo <spy...@gmail.com> wrote:
> I frequently have to clean up lines with:
>
> s/^\s+//;
> s/\s+$//;
>
> Is there ONE regex (as in ONE, SINGLE s///, not one compound
> statement) that can do both of these ?
>
> Thanks & happy Gnu Year.

DOH Nevermind I found it.. I didnt know ^ and $ could be in parens..

s/(^\s+)|(\s+$)//g;



------------------------------

Date: Wed, 19 Jan 2011 11:22:34 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
To: Spydo <spydox@gmail.com>
Subject: Re: one regex to do the work of two?
Message-Id: <86vd1kn1fp.fsf@red.stonehenge.com>

>>>>> "Spydo" == Spydo  <spydox@gmail.com> writes:

Spydo> s/^\s+//;
Spydo> s/\s+$//;

Spydo> Is there ONE regex (as in ONE, SINGLE s///, not one compound
Spydo> statement) that can do both of these ?

Only if you sacrifice runtime efficiency. :)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.posterous.com/ for Smalltalk discussion


------------------------------

Date: Wed, 19 Jan 2011 13:32:10 -0600
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: one regex to do the work of two?
Message-Id: <slrnijeeto.esk.tadmc@tadbox.sbcglobal.net>

Spydo <spydox@gmail.com> wrote:
> I frequently have to clean up lines with:
>
> s/^\s+//;
> s/\s+$//;
>
> Is there ONE regex (as in ONE, SINGLE s///, not one compound
> statement) that can do both of these ?


Your Question is Asked Frequently:

    perldoc -q space

        How do I strip blank space from the beginning/end of a string?


-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.liamg\100cm.j.dat/"
The above message is a Usenet post.
I don't recall having given anyone permission to use it on a Web site.


------------------------------

Date: Wed, 19 Jan 2011 17:57:27 -0800
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: one regex to do the work of two?
Message-Id: <nh5fj69ln8tjvcun68895jc83u8hraj22s@4ax.com>

Spydo <spydox@gmail.com> wrote:
>I frequently have to clean up lines with:
>
>s/^\s+//;
>s/\s+$//;
>
>Is there ONE regex (as in ONE, SINGLE s///, not one compound
>statement) that can do both of these ?

Yes, there is but it doesn't make much sense to use it. 
See the relevent FAQ 
	perldoc -q "strip blank"
for details.

jue


------------------------------

Date: Wed, 19 Jan 2011 23:12:45 -0800
From: "John W. Krahn" <jwkrahn@example.com>
Subject: Re: one regex to do the work of two?
Message-Id: <NfRZo.4273$a_.3926@newsfe10.iad>

Spydo wrote:
> On Jan 19, 1:24 pm, Spydo<spy...@gmail.com>  wrote:
>> I frequently have to clean up lines with:
>>
>> s/^\s+//;
>> s/\s+$//;
>>
>> Is there ONE regex (as in ONE, SINGLE s///, not one compound
>> statement) that can do both of these ?
>>
>> Thanks&  happy Gnu Year.
>
> DOH Nevermind I found it.. I didnt know ^ and $ could be in parens..
>
> s/(^\s+)|(\s+$)//g;

There is no need for the parentheses

s/^\s+|\s+$//g;

Does the same without having to save data to $1 and $2.



John
-- 
Any intelligent fool can make things bigger and
more complex... It takes a touch of genius -
and a lot of courage to move in the opposite
direction.                   -- Albert Einstein


------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

Back issues are available via anonymous ftp from
ftp://cil-www.oce.orst.edu/pub/perl/old-digests. 

#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V11 Issue 3261
***************************************


home help back first fref pref prev next nref lref last post