class_docstr: MemoryProfiler, which is implemented based on memory profiler and Accumulator
class_docstr_tok: ["MemoryProfiler",",","which","is","implemented","based","on","memory","profiler","and","Accumulator"]
docstr: Dump the memory profile into path, id is the PythonUDF id
docstr_tok: ["Dump","the","memory","profile","into","path",",","id","is","the","PythonUDF","id"]
code: def dump(self, id: int, path: str) -> None:
      """Dump the memory profile into path, id is the PythonUDF id"""
      if not os.path.exists(path):
          os.makedirs(path)
      stats = self.stats()  # dict
      if stats:
          p = os.path.join(path, "udf_%d_memory.txt" % id)
          with open(p, "w+") as f:
              self._show_results(stats, stream=f)
  
imports: from typing import Any, Callable, Dict, List, Optional, Tuple, Type, TYPE_CHECKING, Union, cast
  import cProfile
  import inspect
  import pstats
  import linecache
  import os
  import atexit
  import sys
  import warnings
  from pyspark.accumulators import AccumulatorParam
  from pyspark.errors import PySparkRuntimeError
label_desc: Use image node_id 6 for calling the MemoryProfiler obj's underlying member method code with example usage: obj.dump(id, path) without return types