Loading ...
Sorry, an error occurred while loading the content.

25945Re: [PBML] Eval and memory problems

Expand Messages
  • Jenda Krynicky
    Jan 9, 2008
      - No I don't. And others don't either.
      - But you do not need to read what I wrote originaly and what you
      replied last time, you remember it, don't you?
      - Because it's all backwards.
      - Why is that?
      - Because it's hard to read.
      - Why?
      - Please do not top-post!

      Since the proposed change decreases the number of eval""s from
      (number of tests)*(number of lines in logfile)
      to just
      (number of tests)
      any leaks in eval"" should be irrelevant.

      Jenda

      From: Computer-Dribble <computerdribble@...>
      > One problem I ran into was the EVAL was killing 4 gigs
      > of memeory on large log files. At least I traced it
      > back to that.
      >
      > This is why I wanted to avoid EVAL completely and do
      > some macro expansion.
      >
      > thanks again!!
      >
      > Joe.
      >
      > --- Jenda Krynicky <Jenda@...> wrote:
      >
      > > From: "computerdribble" <computerdribble@...>
      > > > The "specific things" are stored in a mysql
      > > database as a regex expression
      > > > Example:
      > > >
      > > > ( ( $field =~ /blah/) and ($field =~ /that/) )
      > > >
      > > > I open the MySql database, no problem, load the
      > > contents into arrays,
      > > > no problem.
      > > >
      > > > Open the log file (approx 1.48megs in size) for
      > > reading only.
      > > >
      > > > I have a logic loop
      > > >
      > > > grab a line from the log file
      > > >
      > > > run all regex expressions against the log line
      > > grabbed. This could be
      > > > from 1 to 500 different tests.
      > > >
      > > >
      > > > its done in a EVAL statement.
      > > >
      > > > similar to:
      > > >
      > > > if ( eval $array[$vartoarraycontents] )
      > >
      > > Compile each test just once and run it repeatedly.
      > > Before opening the log file, but after reading the
      > > expressions do
      > > something like
      > >
      > > for my $test (@array) {
      > > $test = eval 'sub { ' . $test . '}'
      > > or die "Failed to compile '$test' : $@\n";
      > > }
      > >
      > > and then while looping through the logfile use
      > >
      > > if ($array[$vartoarraycontents]->()) {
      > >
      > > There is a possible catch though! The variables you
      > > plan to make
      > > available to the tests must be declared before the
      > > tests are compiled
      > > by those eval('sub {'...) statements!
      > >
      > > Jenda
      > > ===== Jenda@... === http://Jenda.Krynicky.cz
      > > =====
      > > When it comes to wine, women and song, wizards are
      > > allowed
      > > to get drunk and croon as much as they like.
      > > -- Terry Pratchett in Sourcery
      > >
      > >
      > >
      > > Unsubscribing info is here:
      > > http://help.yahoo.com/help/us/groups/groups-32.html
      > > Yahoo! Groups Links
      > >
      > >
      > > mailto:perl-beginner-fullfeatured@yahoogroups.com
      > >
      > >
      > >
      >
      >
      >
      > ____________________________________________________________________________________
      > Never miss a thing. Make Yahoo your home page.
      > http://www.yahoo.com/r/hs
      >
      >
      > Unsubscribing info is here: http://help.yahoo.com/help/us/groups/groups-32.html
      > Yahoo! Groups Links
      >
      >
      >
      >


      ===== Jenda@... === http://Jenda.Krynicky.cz =====
      When it comes to wine, women and song, wizards are allowed
      to get drunk and croon as much as they like.
      -- Terry Pratchett in Sourcery
    • Show all 15 messages in this topic