# Why isn't there a WeakPointer type alongside ArcPointer in Mojo?

**URL:** <https://forum.modular.com/t/why-isnt-there-a-weakpointer-type-alongside-arcpointer-in-mojo/1990>\
**Category:** Mojo\
**Created:** [July 19, 2025, 3:50pm UTC](https://forum.modular.com/t/why-isnt-there-a-weakpointer-type-alongside-arcpointer-in-mojo/1990 "2025-07-19T15:50:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![wolfram](https://avatars.discourse-cdn.com/v4/letter/w/e68b1a/32.png) [@wolfram](https://forum.modular.com/u/wolfram)\
**Post date:** [July 19, 2025, 3:50pm UTC](https://forum.modular.com/t/why-isnt-there-a-weakpointer-type-alongside-arcpointer-in-mojo/1990/1 "2025-07-19T15:50:55Z")

</div>

Hello Mojo community 👋

I’ve been working with `ArcPointer[T]` for shared ownership and atomic reference counting. However, I noticed there’s no equivalent weak pointer type (e.g., `WeakPointer`) with `.downgrade()` / `.upgrade()` behavior to support non-owning references or break reference cycles.

According to the official docs, `ArcPointer[T]` supports:

- Strong ownership through atomic reference counting.
- Shared access and thread safety in copying.
- No mention of weak pointers or cycle-aware deallocation. [docs.modular.com](https://docs.modular.com/mojo/manual/pointers/)[ArcPointer](https://docs.modular.com/mojo/stdlib/memory/arc/ArcPointer)

I also didn’t find any standard library type like `WeakPointer` or methods such as `.downgrade()` or `.upgrade()`.

My questions:

1. Was leaving out `WeakPointer` an intentional design choice?
2. Is there a recommended pattern in Mojo to handle cycles or create non-owning references safely?
3. Are there plans to introduce weak references (or something similar) in a future release?

Thanks in advance for any clarification or guidance!

---

<div class="post-metadata">

**Author:** ![owenhilyard](https://sea1.discourse-cdn.com/flex001/user_avatar/forum.modular.com/owenhilyard/32/41_2.png) [@owenhilyard](https://forum.modular.com/u/owenhilyard)\
**Post date:** [July 19, 2025, 4:16pm UTC](https://forum.modular.com/t/why-isnt-there-a-weakpointer-type-alongside-arcpointer-in-mojo/1990/2 "2025-07-19T16:16:45Z")

</div>

There was a PR to add a weak pointer type along with some fixes to ArcPointer, but the idea was to avoid burdening ArcPointer, which is typically used without a need for reference cycles (think `Arc<Mutex<T>>` in Rust) with the extra book keeping. Nobody has done the work for the separate, cycle-handling type mostly because nobody has had a need for a cyclic graph with an unbounded member set, so people will instead just allocate all the nodes at once, use references, and free them all at the same time.

Contributions are welcome, so if you want a copy of `ArcPointer` which does have a `WeakPointer` counterpart we should be able to include it in the standard library. Right now, most of the data structures in the standard library are there because someone needed them, since Mojo is running a fairly lean standard library unless there is a good motivating use-case. Cycle-handling atomic reference counting is one of those things that is probably a good idea. While you’re building it, you might also want to build in a switch to make it use atomic ops for extra speed in single-threaded contexts. We’ll circle back around when the concurrency model is more complete for stuff thread safety.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex001/uploads/modular/original/1X/2751e0fbdc595a99718b216730957e9db4448cfd.jpeg) [@system](https://forum.modular.com/u/system)\
**Post date:** [July 26, 2025, 4:17pm UTC](https://forum.modular.com/t/why-isnt-there-a-weakpointer-type-alongside-arcpointer-in-mojo/1990/3 "2025-07-26T16:17:21Z")

</div>

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
