Two different ways to calculate depending on memory usage.