Fix memory leaks for Python dicts in C extension

This commit is contained in:
Philipp Moritz
2016-06-20 12:05:54 -07:00
parent ac65f1031e
commit e6a188b2e0
2 changed files with 40 additions and 7 deletions
+17
View File
@@ -0,0 +1,17 @@
# This code reproduces a memory leak we had in the past
import os
import numpy as np
import ray
import ray.worker
import ray.services as services
worker_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "test_worker.py")
services.start_singlenode_cluster(return_drivers=False, num_workers_per_objstore=1, worker_path=worker_path)
d = {"w": np.zeros(1000000)}
obj_capsule, contained_objrefs = ray.lib.serialize_object(ray.worker.global_worker.handle, d)
while True:
ray.lib.deserialize_object(ray.worker.global_worker.handle, obj_capsule)