code: def test_auto_global_gc(shutdown_only):
      # 100MB
      ray.init(num_cpus=1, object_store_memory=100 * 1024 * 1024)
  
      @ray.remote
      class Test:
          def __init__(self):
              self.collected = False
              import gc
  
              gc.disable()
  
              def gc_called(phase, info):
                  self.collected = True
  
              gc.callbacks.append(gc_called)
  
          def circular_ref(self):
              # 20MB
              buf1 = b"0" * (10 * 1024 * 1024)
              buf2 = b"1" * (10 * 1024 * 1024)
              ref1 = ray.put(buf1)
              ref2 = ray.put(buf2)
              b = []
              a = []
              b.append(a)
              a.append(b)
              b.append(ref1)
              a.append(ref2)
              return a
  
          def collected(self):
              return self.collected
  
      test = Test.remote()
      # 60MB
      for i in range(3):
          ray.get(test.circular_ref.remote())
      time.sleep(2)
      assert not ray.get(test.collected.remote())
      # 80MB
      for _ in range(1):
          ray.get(test.circular_ref.remote())
      time.sleep(2)
      assert ray.get(test.collected.remote())
  
file_path: ray/python/ray/tests/test_basic_3.py
imports: import logging
  import random
  import sys
  import time
  import pytest
  import ray
  import ray.cluster_utils
  from ray._private.test_utils import dicts_equal
label_desc: Use image node_id 1 for calling a global function with example usage: test_auto_global_gc(shutdown_only) and returns: a, self