Use rrd_freemem to free memory
or Win32 try to return the librrd-4 heap allocated memory to the rrdtool's heap.