code: def test_concat_memory_leak(large_clf, estimator_type, i):
      import gc
      import os
  
      try:
          import psutil
      except ImportError:
          pytest.skip("psutil not installed")
  
      process = psutil.Process(os.getpid())
  
      X, y = large_clf
      X = X.astype(np.float32)
  
      # Build a series of RF models
      n_models = 10
      if estimator_type == "classification":
          base_models = [
              curfc(max_depth=10, n_estimators=100, random_state=123)
              for i in range(n_models)
          ]
          y = y.astype(np.int32)
      elif estimator_type == "regression":
          base_models = [
              curfr(max_depth=10, n_estimators=100, random_state=123)
              for i in range(n_models)
          ]
          y = y.astype(np.float32)
      else:
          assert False
  
      # Pre-fit once - this is our baseline and memory usage
      # should not significantly exceed it after later fits
      for model in base_models:
          model.fit(X, y)
  
      # Just concatenate over and over in a loop
      concat_models = base_models[1:]
      init_model = base_models[0]
      other_handles = [
          model._obtain_treelite_handle() for model in concat_models
      ]
      init_model._concatenate_treelite_handle(other_handles)
  
      gc.collect()
      initial_baseline_mem = process.memory_info().rss
      for i in range(10):
          init_model._concatenate_treelite_handle(other_handles)
          gc.collect()
          used_mem = process.memory_info().rss
          logger.debug(
              "memory at rep %2d: %d m"
              % (i, (used_mem - initial_baseline_mem) / 1e6)
          )
  
      gc.collect()
      used_mem = process.memory_info().rss
      logger.info(
          "Final memory delta: %d"
          % ((used_mem - initial_baseline_mem) / 1e6)
      )
  
      # increasing margin to avoid very infrequent failures
      assert (used_mem - initial_baseline_mem) < 1.1e6
  
imports: import treelite
  from sklearn.model_selection import train_test_split
  from sklearn.datasets import fetch_california_housing, make_classification, make_regression, load_iris, load_breast_cancer
  from sklearn.metrics import accuracy_score, mean_squared_error, mean_tweedie_deviance
  from sklearn.ensemble import RandomForestRegressor
  from sklearn.ensemble import RandomForestClassifier
  import cuml.internals.logger
  from cuml.testing.utils import get_handle, unit_param, quality_param, stress_param
  from cuml.metrics import r2_score
  from cuml.ensemble import RandomForestRegressor
  from cuml.ensemble import RandomForestClassifier
  import cuml
  from cuml.internals.safe_imports import gpu_only_import_from
  import os
  import json
  import random
  from cuml.internals.safe_imports import cpu_only_import
  import pytest
  import warnings
  from cuml.internals.safe_imports import gpu_only_import
label_desc: Use image node_id 26 for calling a global function with example usage: test_concat_memory_leak(large_clf, estimator_type, i) without return types