Added totalMemoryUsage

added only the function and the tests are not included.