# Any way to figure out if a WeakRef is referenced elsewhere?

**URL:** https://discourse.julialang.org/t/any-way-to-figure-out-if-a-weakref-is-referenced-elsewhere/25380
**Category:** General Usage
**Created:** [June 17, 2019, 8:52pm UTC](https://discourse.julialang.org/t/any-way-to-figure-out-if-a-weakref-is-referenced-elsewhere/25380 "2019-06-17T20:52:54Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![marius311](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/marius311/32/3953_2.png) [@marius311](https://discourse.julialang.org/u/marius311)
#### Post date: [June 17, 2019, 8:52pm UTC](https://discourse.julialang.org/t/any-way-to-figure-out-if-a-weakref-is-referenced-elsewhere/25380/1 "2019-06-17T20:52:54Z")

</div>

If I have a `WeakRef` to an object, is there any more efficient way to figure out if its referenced elsewhere, other than just running a `GC.gc()` and checking if my WeakRef value has become nothing?

---

<div class="post-metadata">

### Author: ![yuyichao](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yuyichao/32/20_2.png) [@yuyichao](https://discourse.julialang.org/u/yuyichao)
#### Post date: [June 17, 2019, 9:26pm UTC](https://discourse.julialang.org/t/any-way-to-figure-out-if-a-weakref-is-referenced-elsewhere/25380/2 "2019-06-17T21:26:42Z")

</div>

No. That I formation can only be computed during GC.

---

<div class="post-metadata">

### Author: ![marius311](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/marius311/32/3953_2.png) [@marius311](https://discourse.julialang.org/u/marius311)
#### Post date: [June 17, 2019, 10:31pm UTC](https://discourse.julialang.org/t/any-way-to-figure-out-if-a-weakref-is-referenced-elsewhere/25380/3 "2019-06-17T22:31:22Z")

</div>

Thanks, fair enough. Could you possibly explain what the `full` argument to `GC.gc` does? I can’t really find much documentation, but it certainly makes things much faster and alleviates some of why I asked my question in the first place. But its not clear what a non-`full` GC might miss?

---

<div class="post-metadata">

### Author: ![yuyichao](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yuyichao/32/20_2.png) [@yuyichao](https://discourse.julialang.org/u/yuyichao)
#### Post date: [June 17, 2019, 10:45pm UTC](https://discourse.julialang.org/t/any-way-to-figure-out-if-a-weakref-is-referenced-elsewhere/25380/4 "2019-06-17T22:45:08Z")

</div>

Non full GC ignores old objects, I.e. objects that have lived for a long time (lived many collections). This is based on the assumptions that young objects dies fast. Search generational GC to learn more.
