From db2ce4886c25a42fc46a14a3bcac13c14312611f Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Tue, 19 Nov 2019 09:11:45 +0100 Subject: [PATCH] status/graphite: fix memory leak, avoid cyclic closure reference The data passed to this closure was never free'd, depending on the count of VM/CTs one could get >1 MB of RSS (!) memory leaked per statd status cycle update run... We could also use Scalar::Util's weaken, to weak a copy of this variable, but as a simple undef works lets do that with a comment.. Signed-off-by: Thomas Lamprecht --- PVE/Status/Graphite.pm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/PVE/Status/Graphite.pm b/PVE/Status/Graphite.pm index 14180aef..28fa65fd 100644 --- a/PVE/Status/Graphite.pm +++ b/PVE/Status/Graphite.pm @@ -141,6 +141,8 @@ sub assemble { } }; $assemble_graphite_data->($data, $path); + + $assemble_graphite_data = undef; # avoid cyclic reference! } PVE::JSONSchema::register_format('graphite-path', \&pve_verify_graphite_path);