[26955] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 8913 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Feb 2 18:05:52 2006

Date: Thu, 2 Feb 2006 15:05:12 -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, 2 Feb 2006     Volume: 10 Number: 8913

Today's topics:
    Re: Memory usage <rugowski1spm@nhw.pl>
    Re: Memory usage <xx087@freenet.carleton.ca>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Thu, 02 Feb 2006 20:27:16 +0100
From: Witold Rugowski <rugowski1spm@nhw.pl>
Subject: Re: Memory usage
Message-Id: <drtmem$ep$1@hplms2.hpl.hp.com>

A. Sinan Unur wrote:
> By not posting a short but complete script or any real code, you have 
> shown that you do not appreciate the value of others' time thereby 
> significantly reducing or eliminating the chance to get responses to any 

That is not true (about not appreciating time). Error was caused by logical merit of variables $1, $2, etc from regexp. So, when I send my first post I was desperate :)), tired, and without access to code. At moment when I got access to code I found a bug and I think that it would be hard to spot it without knowing intentions of what code was should do. 

So, buggy was following part:

  if ( $_ =~ /([\w\d\-\_\.]*) (\w\w\w \d\d \d\d\d\d \d\d:\d\d:\d\d) [\w\d\-\_\.: ]* %PIX-(\d)-(\d*): (.*)/ )
    {
	[a lot of good code]

    $logID = "PIX-$2-$3";       #reassembling PIX syslog log ID
    if (!defined ($MSG{$logID}) ) {
      print "New comm - $logID\n" if ($opts{v});
      chomp;
      $MSG{$logID} = $_;
    }

So using wrong $2 and $3 (instead $4 and $5) caused MSG hash to grow...

Checking out previous version and removing changes one by one helped to find real cause...

At the end question is if Dump::Dumper can dump ALL variables in scope without enumerating them as an arguments? Because I used it to dump all variables pointing them directly, I was sure that any of my variables is responsible for memory consumption. I was wrong since I have omitted %MSG. 

-- 
Witold Rugowski
rugowski_at_nhw_pl
http://nhw.pl/blg/


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

Date: 2 Feb 2006 19:50:13 GMT
From: Glenn Jackman <xx087@freenet.carleton.ca>
Subject: Re: Memory usage
Message-Id: <slrndu4ojl.5bi.xx087@smeagol.ncf.ca>

At 2006-02-02 02:27PM, Witold Rugowski <rugowski1spm@nhw.pl> wrote:
>    if ( $_ =~ /([\w\d\-\_\.]*) (\w\w\w \d\d \d\d\d\d \d\d:\d\d:\d\d) [\w\d\-\_\.: ]* %PIX-(\d)-(\d*): (.*)/ )

That can be simplified to:
    my $date_re = qr(\w{3} \d{2} \d{4} \d{2}:\d{2}:\d{2});
    if (/([\w.-]*) ($date_re) [\w.: -]* %PIX-(\d)-(\d*): (.*)/) {
        ... use $1, $2, $3, $4, $5 ...
    }

- $_ is the default target of the match operator
- the \w class includes underscore and digits.
- dot is not special in a character class.


-- 
Glenn Jackman
Ulterior Designer


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

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:

#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc.  For subscription or unsubscription requests, send
#the single line:
#
#	subscribe perl-users
#or:
#	unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

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

#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.

#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 V10 Issue 8913
***************************************


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