http://www.perlmonks.org?node_id=127197


in reply to Re: Re: Perl memory Memory consumption
in thread Perl memory Memory consumption

Does the program grow if you leave out that process_msg subroutine call?

Also, use strict and my variables where possible, and don't make circular references like $a = \$b; $b = \$a;, or they'll never really get out of scope (they might go out of scope and be unreachable, but since they refer to eachother, they'll never go away)

Replies are listed 'Best First'.
Re: Re: Re: Re: Perl memory Memory consumption
by alfatux (Novice) on Nov 26, 2001 at 20:19 UTC
    Hi,

    No, with process_msg the program not gows.

    I've investigating more an I detect that the problem could be in the get_msg funtion that looks like:
    
    
    sub get_msg {
    
    
      my $self = shift;
    
    
      my ($param) = @_;
    
    
      my $consulta_stack = qq{
    
    
                             SELECT *
    
    
                             FROM out
    
    
                             WHERE app = $param
    
    
                             ORDER BY id DESC LIMIT 100;
    
    
                            };
    
    
      my $sth = $self->{dbh}->prepare($consulta_stack);
    
    
      $sth->execute();
    
    
      my $msgs = $sth->fetchall_hashref('id');
    
    
      $sth->finish;
    
    
      return $msgs;
    
    
    }
    
    
    
    I also observ that when there's no record in the resultset memory consumption is highter than when there's sontehing.