Move null check from getTotalMemory()