On Fri, 6 Oct 2000, Bill Moseley wrote:
> At 09:06 AM 10/06/00 -0400, Andreas Schiffler wrote:
>
> Along with what Matt recommended (although I would have suggested beer,
> too), something I did yesterday to track down a leak was to go into every
> module I had modified lately and added warn's in both the new() and DESTROY
> methods that wrote a warning message saying that the object was
> created/destroyed. In my case I found I had a circular reference on an
> object and it was never being destroyed.
Forgot about that (my leak wasn't in circular refs, so I'd already done
that to no avail). Its often useful to have a counter:
package MyPackage;
use vars qw/$COUNTER/;
sub new {
my $class = shift;
warn "Now: ", ++$COUNTER, " refs of type $class\n";
bless {}, $class;
}
sub DESTROY {
my $obj = shift;
warn "Now: ", --$COUNTER, "refs of type ", ref($obj), "\n";
}
--
<Matt/>
** Director and CTO **
** AxKit.com Ltd ** ** XML Application Serving **
** http://axkit.org ** ** XSLT, XPathScript, XSP **
** Personal Web Site: http://sergeant.org/ **