# Memory not released to default levels: \`ray::IDLE\` Processes Not Released\*\*

**URL:** <https://discuss.ray.io/t/memory-not-released-to-default-levels-ray-idle-processes-not-released/23295>\
**Category:** Ray Serve\
**Created:** [November 1, 2025, 10:22am UTC](https://discuss.ray.io/t/memory-not-released-to-default-levels-ray-idle-processes-not-released/23295 "2025-11-01T10:22:46Z")\
**Posts on this page:** 1\
**Showing post:** 27

<div class="post-metadata">

**Author:** ![RunLLM](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/runllm/32/8249_2.png) [@RunLLM](https://discuss.ray.io/u/RunLLM)\
**Post date:** [November 12, 2025, 5:11pm UTC](https://discuss.ray.io/t/memory-not-released-to-default-levels-ray-idle-processes-not-released/23295/27 "2025-11-12T17:11:11Z")

</div>

The ReferenceCountingAssertionError in your case is caused by the use of max\_calls=2 on your remote function. When a Ray worker reaches its max\_calls limit, it is terminated and any objects it owns (including ObjectRefs it created) are also deleted—even if other tasks or actors still hold references to those objects. This leads to the ReferenceCountingAssertionError when you try to access an ObjectRef whose owner (the worker) has already exited ([GitHub issue 18456](https://github.com/ray-project/ray/issues/18456), [Ray Discourse: getting reference counting assertion error](https://discuss.ray.io/t/getting-reference-counting-assertation-error-when-storing-objectrefs-in-class-variables/7624)).

**Workaround:**  
To avoid this, you should ensure that the owner of the ObjectRef is a long-lived actor (such as your PlasmaStoreActor) and that the ObjectRef is passed to and stored by this actor before the worker that created it exits. Specifically, after creating the ObjectRef with ray.put(data, \_owner=actor), call a method on the actor to store the reference, and only then allow the worker to exit. This ensures the reference count is properly updated and the object is not prematurely deleted. Avoid using max\_calls on remote functions that create and return ObjectRefs unless you are certain the references will not be needed after the worker exits.

Would you like a code example of this pattern?

Sources:

- [GitHub issue 18456](https://github.com/ray-project/ray/issues/18456)
- [Ray Discourse: getting reference counting assertion error](https://discuss.ray.io/t/getting-reference-counting-assertation-error-when-storing-objectrefs-in-class-variables/7624)

Hint: Mention @RunLLM in the post for followups.

---

_[View the full topic](https://discuss.ray.io/t/memory-not-released-to-default-levels-ray-idle-processes-not-released/23295)._
