class_docstr: Hold all parsed data to serve for user requests.
class_docstr_tok: ["Hold","all","parsed","data","to","serve","for","user","requests","."]
code: def get_op_memory_events(self, device_type, search_name=None):
      if not self.memory_parser:
          return
      data = {}
      data["column_name"] = [
          "EventName",
          "MemoryType",
          "AllocationCount",
          "FreeCount",
          "AllocationSize",
          "FreeSize",
          "IncreasedSize",
      ]
      data["data"] = []
      allocated_events = self.allocated_items[device_type]
  
      def filter_func(item):
          nonlocal search_name
          if not search_name:
              return True
          else:
              if search_name in item[0]:
                  return True
          return False
  
      reserved_events = self.reserved_items[device_type]
      all_events = [
          (key, item) for key, item in allocated_events.items()
      ]
      all_events.extend(
          [(key, item) for key, item in reserved_events.items()]
      )
      if search_name:
          all_events = filter(filter_func, all_events)
      sorted_items = sorted(
          all_events, key=lambda x: x[1].increase_size, reverse=True
      )
      if not sorted_items:
          return data
      for event_name, item in sorted_items:
          data["data"].append(
              {
                  "EventName": event_name,
                  "MemoryType": item.memory_type,
                  "AllocationCount": item.allocation_count,
                  "FreeCount": item.free_count,
                  "AllocationSize": format_memory(
                      item.allocation_size, "KB"
                  ),
                  "FreeSize": format_memory(item.free_size, "KB"),
                  "IncreasedSize": format_memory(
                      item.increase_size, "KB"
                  ),
              }
          )
      return data
  
imports: from collections import defaultdict
  from collections import OrderedDict
  from .parser.distributed_parser import DistributedParser
  from .parser.kernel_parser import KernelParser
  from .parser.memory_parser import MemoryParser
  from .parser.operator_parser import OperatorParser
  from .parser.overview_parser import CPUType
  from .parser.overview_parser import GPUType
  from .parser.overview_parser import OverviewParser
  from .parser.trace_parser import TraceParser
  from .parser.utils import format_float
  from .parser.utils import format_memory
  from .parser.utils import format_ratio
  from .parser.utils import format_time
  from .parser.utils import traverse_tree
label_desc: Use image node_id 19 for calling the ProfilerData obj's underlying member method code with example usage: obj.get_op_memory_events(device_type, search_name) and returns: data, False, data, True, True