diff --git a/rllib/utils/memory.py b/rllib/utils/memory.py index 0c04bb15d..89ab4ae6b 100644 --- a/rllib/utils/memory.py +++ b/rllib/utils/memory.py @@ -1,5 +1,6 @@ import numpy as np import time +import os import ray @@ -8,6 +9,10 @@ MAX_FREE_QUEUE_SIZE = 100 _last_free_time = 0.0 _to_free = [] +# TODO(ekl) remove this feature entirely. It's here for now just in case we +# need to turn it on for debugging. +RLLIB_DEBUG_EXPLICIT_FREE = bool(os.environ.get("RLLIB_DEBUG_EXPLICIT_FREE")) + def ray_get_and_free(object_ids): """Call ray.get and then queue the object ids for deletion. @@ -23,6 +28,9 @@ def ray_get_and_free(object_ids): The result of ray.get(object_ids). """ + if not RLLIB_DEBUG_EXPLICIT_FREE: + return ray.get(object_ids) + global _last_free_time global _to_free