code: def memory_used(self):
          
          if self._end_memory:
              memory_used = self._end_memory - self._start_memory
              return memory_used
          else:
              return None
docs: To know the allocated memory at function termination.
  
          ..versionadded:: 4.1
  
          This property might return None if the function is still running.
  
          This function should help to show memory leaks or ram greedy code.