code: def test_leak2():
      data = [pa.array(np.concatenate([np.random.randn(100000)] * 10))]
      table = pa.Table.from_arrays(data, ["foo"])
  
      def func():
          df = table.to_pandas()
  
          batch = pa.RecordBatch.from_pandas(df)
  
          sink = io.BytesIO()
          writer = pa.RecordBatchFileWriter(sink, batch.schema)
          writer.write_batch(batch)
          writer.close()
  
          buf_reader = pa.BufferReader(sink.getvalue())
          reader = pa.open_file(buf_reader)
          reader.read_all()
  
      assert_does_not_leak(func, iterations=50, tolerance=50)
  
file_path: arrow/python/scripts/test_leak.py
imports: import pyarrow
  import numpy
  import pandas
  from pyarrow.tests.util import rands
  import memory_profiler
  import gc
  import io
label_desc: Use image node_id 3 for calling a global function with example usage: test_leak2() without return types