While restoring, rrd_restore uses between 30 and 40 times as much memory as
authoroetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa>
Mon, 25 May 2009 22:23:06 +0000 (22:23 +0000)
committeroetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa>
Mon, 25 May 2009 22:23:06 +0000 (22:23 +0000)
commit9e0553265a0b0d700d1b75891b97dc5cf1031680
tree040481b59e3fda5fbc5acdde4b4b0634f9b453d1
parent896f660d222db6362e6171c68d33e8eecdc0d57a
While restoring, rrd_restore uses between 30 and 40 times as much memory as
the size of the rrd file to be restored. This is due to the use of libxml2
for parsing the the whole file prior to turning it into rrd structs.

This patch switches rrd_restore to using the xmlTextReader interface for
incremental consumtion of xml files. This reduces the memory requirements to
about twice the size of the rrd file which should be quite manageable for
most cases.

The parsing is about 25% less efficient than with the original libxml2
version of rrd_restore. This could be in part due to the more liberal use of
malloced memory. Optimizing this is for another day though.

--tobi

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1811 a5681a0c-68f1-0310-ab6d-d61299d08faa
src/rrd_restore.c