r3891 - trunk/varnish-tools/webgui/Varnish
petter at projects.linpro.no
petter at projects.linpro.no
Fri Mar 6 08:58:07 CET 2009
Author: petter
Date: 2009-03-06 08:58:07 +0100 (Fri, 06 Mar 2009)
New Revision: 3891
Modified:
trunk/varnish-tools/webgui/Varnish/Group.pm
trunk/varnish-tools/webgui/Varnish/Management.pm
trunk/varnish-tools/webgui/Varnish/Node.pm
trunk/varnish-tools/webgui/Varnish/RequestHandler.pm
Log:
Not holding a reference to data in freed objects is a good way of avoiding memory leaks.
Modified: trunk/varnish-tools/webgui/Varnish/Group.pm
===================================================================
--- trunk/varnish-tools/webgui/Varnish/Group.pm 2009-03-05 22:33:08 UTC (rev 3890)
+++ trunk/varnish-tools/webgui/Varnish/Group.pm 2009-03-06 07:58:07 UTC (rev 3891)
@@ -24,6 +24,14 @@
return $new_object;
}
+ sub DESTROY {
+ my ($self) = @_;
+
+ delete $id_of{$self};
+ delete $name_of{$self};
+ delete $active_vcl_of{$self};
+ }
+
sub get_id {
my ($self) = @_;
Modified: trunk/varnish-tools/webgui/Varnish/Management.pm
===================================================================
--- trunk/varnish-tools/webgui/Varnish/Management.pm 2009-03-05 22:33:08 UTC (rev 3890)
+++ trunk/varnish-tools/webgui/Varnish/Management.pm 2009-03-06 07:58:07 UTC (rev 3891)
@@ -27,6 +27,16 @@
return $new_object;
}
+ sub DESTROY {
+ my ($self) = @_;
+
+ delete $hostname_of{$self};
+ delete $port_of{$self};
+ close();
+ delete $socket_of{$self};
+ delete $secret_of{$self};
+ }
+
sub _read_cli_response {
my ($socket) = @_;
Modified: trunk/varnish-tools/webgui/Varnish/Node.pm
===================================================================
--- trunk/varnish-tools/webgui/Varnish/Node.pm 2009-03-05 22:33:08 UTC (rev 3890)
+++ trunk/varnish-tools/webgui/Varnish/Node.pm 2009-03-06 07:58:07 UTC (rev 3891)
@@ -47,6 +47,15 @@
my ($self) = @_;
$management_of{$self}->close();
+
+ delete $id_of{$self};
+ delete $name_of{$self};
+ delete $address_of{$self};
+ delete $port_of{$self};
+ delete $group_id_of{$self};
+ delete $management_of{$self};
+ delete $management_port_of{$self};
+ delete $management_secret_of{$self};
}
sub get_id {
Modified: trunk/varnish-tools/webgui/Varnish/RequestHandler.pm
===================================================================
--- trunk/varnish-tools/webgui/Varnish/RequestHandler.pm 2009-03-05 22:33:08 UTC (rev 3890)
+++ trunk/varnish-tools/webgui/Varnish/RequestHandler.pm 2009-03-06 07:58:07 UTC (rev 3891)
@@ -43,6 +43,9 @@
my ($self) = @_;
delete $request_ref_of{$self};
+ delete $response_content_ref_of{$self};
+ delete $response_header_ref_of{$self};
+ delete $master_tmpl_var_of{$self};
return;
}
@@ -520,6 +523,7 @@
};
if (!$tmpl_var{'stat_time'}) {
+ $stat_time ||= 0;
$tmpl_var{'stat_time'} = strftime("%a %b %e %H:%M:%S %Y", localtime($stat_time));
}
More information about the varnish-commit
mailing list