class_docstr: Generically tests our memory leak diagnostics tools.
class_docstr_tok: ["Generically","tests","our","memory","leak","diagnostics","tools","."]
docstr: Tests, whether our diagnostics tools can detect leaks in an env.
docstr_tok: ["Tests",",","whether","our","diagnostics","tools","can","detect","leaks","in","an","env","."]
code: def test_leaky_env(self):
      """Tests, whether our diagnostics tools can detect leaks in an env."""
      config = (
          ppo.PPOConfig().environment(
              MemoryLeakingEnv, env_config={"static_samples": True}
          )
          # Make sure we have an env to test on the local worker.
          # Otherwise, `check_memory_leaks` will complain.
          .rollouts(create_env_on_local_worker=True)
      )
      algo = config.build()
      results = check_memory_leaks(algo, to_check={"env"}, repeats=15)
      assert results["env"]
      algo.stop()
  
file_path: ray/rllib/algorithms/tests/test_memory_leaks.py
imports: import unittest
  import ray
  import ray.rllib.algorithms.dqn
  import ray.rllib.algorithms.ppo
  from ray.rllib.examples.env.memory_leaking_env import MemoryLeakingEnv
  from ray.rllib.examples.policy.memory_leaking_policy import MemoryLeakingPolicy
  from ray.rllib.policy.policy import PolicySpec
  from ray.rllib.utils.debug.memory import check_memory_leaks
label_desc: Use image node_id 3 for calling the TestMemoryLeaks obj's underlying member method code with example usage: obj.test_leaky_env() without return types