[EMAIL PROTECTED] wrote:
> Hello,
> 
> I have to write a "daemon" in Perl, with the quite simple structure below :
> 
> sub test {
>    while(1) {
>       Oracle database connection;
>       $state = result of a database query;
> 
>       if ( $state == 1 ) {
>          call to another function;
>       }
>    }
> }
> 
> My function "test" works and makes its job perfectly. Despite this, I have
> pointed a problem out : memory leak. Indeed, the memory size of the process
> grows significantly during its running time, and this is not acceptable.
> I begin to believe writing a such "daemon" in Perl is not a good idea, 
> according
> to articles I read recently. But if someone here has an idea, or suggestions 
> to
> help me, you would spare me a lot of time.
> 
> Thanks for help
> 

How about: perldoc -f delete

Or try:

sub test {
  while(1) {
    _test();
  }
}

sub _test {
      Oracle database connection;
      $state = result of a database query;

      if ( $state == 1 ) {
         call to another function;
      }
}

# All memory used in _test is freed when it is exited.


-- 
__END__

Just my 0.00000002 million dollars worth,
   --- Shawn

"For the things we have to learn before we can do them, we learn by
doing them."
  Aristotle

* Perl tutorials at http://perlmonks.org/?node=Tutorials
* A searchable perldoc is at http://perldoc.perl.org/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to