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 <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2019-11-19 09:11:45 +01:00
parent 1e4ae7d44c
commit db2ce4886c

View File

@ -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);