Re: snmptrapd with attached perl script eats all memory
Max <[email protected]>
| Newsgroups | gmane.network.net-snmp.user |
|---|---|
| Message-ID | <[email protected]> |
I meant 'sub' instead of function of course .. sorry, been doing a lot of PHP recently :p. - Max On Sat, May 31, 2008 at 12:08 AM, Max <[email protected]> wrote: > Hi, > >> # We MUST use $_[0] instead of new variable to change global curLogFile value > > Why do you have to use aliases for all variables? Looks like you just > need to pass filename by reference .. I would change your function > call to use references and just pass logfile by reference .. > > logRotateToFile(\$logfile, $extension, $message); > > function logRotateToFile { > my ($log_file_ref, $ext, $msg) = @_; > # Change global name > ${$log_file_ref} = 'new name'; > .... more code ... > # Undef our reference to make sure we do not leak memory > $log_file_ref = undef; > return; > } > > I think that will clarify your code and maybe explicitly setting the > reference to undef before return will get rid of the leak? > > Just an idea. > > - Max > ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Net-snmp-users mailing list [email protected] Please see the following page to unsubscribe or change other options: https://lists.sourceforge.net/lists/listinfo/net-snmp-users