Fix big memory usage and duplicate datapoints.

By default it will now keep memory size small instead of accumulating until the OS gives a memory warning.

When getting data points from storage the result could contain duplicates (due to a datapoint being both in memory and storage). Fixed.