[rrd-developers] PATCH: Memory leak in HW forecasting apply_smoother
Rene Gallati
security at draxinusom.ch
Fri Jan 28 13:31:42 MET 2005
Hello list,
there is a memory leak in current rrdtool-devel snapshot (today, ie
28-jan-2005 and before).
The memory leak occurs due to a missing free-call in rrd_hw.c
apply_smoother function. (The reference "baseline" is never freed)
The leak occurs only when one uses the Holt-Winters forecasting
mechanisms and only when the smoother needs to run, which happens first
after seasonal period time and then periodically every N updates
(whereas N depends on the amount of RRAs, I believe). It leaks between
16 and 40 bytes per call when it leaks.
Most people will not see the bug because not everyone uses the HW rra's
or they call rrdtool via cmdline in which case all memory is freed by
the OS anyway.
I am currently developing a tool which processes huge amounts of data in
minute steps and several days to weeks in one go using the C api in an
envrionment where memory and cpu usage must not exceed certain
thresholds, which is why I monitor memory usage rigurously and found the
leak.
Anyway, this simple patch fixes the leak:
--- rrd_hw.orig 2005-01-28 13:02:03.000000000 +0100
+++ rrd_hw.c 2005-01-28 13:02:24.000000000 +0100
@@ -668,6 +668,7 @@
fflush(rrd_file);
free(rrd_values);
+ free(baseline);
return 0;
}
Please adapt (filename) and apply
--
C U
- -- ---- ----- -----/\/ René Gallati \/\---- ----- --- -- -
--
Unsubscribe mailto:rrd-developers-request at list.ee.ethz.ch?subject=unsubscribe
Help mailto:rrd-developers-request at list.ee.ethz.ch?subject=help
Archive http://www.ee.ethz.ch/~slist/rrd-developers
WebAdmin http://www.ee.ethz.ch/~slist/lsg2.cgi
More information about the rrd-developers
mailing list