# RayOutOfMemoryError: More than 95% of the memory is used

**URL:** <https://discuss.ray.io/t/rayoutofmemoryerror-more-than-95-of-the-memory-is-used/7406>\
**Category:** Ray Core\
**Created:** [September 1, 2022, 10:45am UTC](https://discuss.ray.io/t/rayoutofmemoryerror-more-than-95-of-the-memory-is-used/7406 "2022-09-01T10:45:33Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![Stephanie\_Wang](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/stephanie_wang/32/18_2.png) [@Stephanie\_Wang](https://discuss.ray.io/u/Stephanie_Wang)\
**Post date:** [September 6, 2022, 9:20pm UTC](https://discuss.ray.io/t/rayoutofmemoryerror-more-than-95-of-the-memory-is-used/7406/4 "2022-09-06T21:20:06Z")

</div>

It looks like the memory issue is probably due to having too many `Agent` actors running in parallel. We’re actively working on this type of problem for v2.1 and 2.2, but for now I think the best thing to try would be to run fewer agents in parallel. There are two ways you can do this:

1. Pass fewer `num_cpus` to `ray.init`, like `ray.init(num_cpus=8)`, even though you have 16 vCPUs available.
2. (suggested) Modify your actor definitions to request more CPUs. You can do this by modifying this [line](https://github.com/yuta0821/agent57_pytorch/blob/main/agent.py#L17).

---

_[View the full topic](https://discuss.ray.io/t/rayoutofmemoryerror-more-than-95-of-the-memory-is-used/7406)._
