# Garbage collecting SharedArrays

**URL:** <https://discourse.julialang.org/t/garbage-collecting-sharedarrays/46510>\
**Category:** Performance\
**Created:** [September 12, 2020, 3:24pm UTC](https://discourse.julialang.org/t/garbage-collecting-sharedarrays/46510 "2020-09-12T15:24:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![atteson](https://avatars.discourse-cdn.com/v4/letter/a/91b2a8/32.png) [@atteson](https://discourse.julialang.org/u/atteson)\
**Post date:** [September 12, 2020, 3:24pm UTC](https://discourse.julialang.org/t/garbage-collecting-sharedarrays/46510/1 "2020-09-12T15:24:39Z")

</div>

I’ve been using some very large SharedArrays. Occasionally, my code allocates one which it wants only for the duration of a function call. However, they don’t seem to be freed and the machine eventually runs out of memory. Is there a way I can explicitly free a SharedArray?

---

<div class="post-metadata">

**Author:** ![atteson](https://avatars.discourse-cdn.com/v4/letter/a/91b2a8/32.png) [@atteson](https://discourse.julialang.org/u/atteson)\
**Post date:** [September 12, 2020, 3:33pm UTC](https://discourse.julialang.org/t/garbage-collecting-sharedarrays/46510/2 "2020-09-12T15:33:43Z")

</div>

I found an issue in the SharedArrays github that helped with this. Running:

```julia
@everywhere GC.gc()

```

at appropriate places fixed this. I’m closing it.
