# Thought: Move GC to packages

**URL:** <https://discourse.julialang.org/t/thought-move-gc-to-packages/129225>\
**Category:** Internals & Design\
**Created:** [May 21, 2025, 3:20pm UTC](https://discourse.julialang.org/t/thought-move-gc-to-packages/129225 "2025-05-21T15:20:27Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tarny\_GG\_Channie](https://avatars.discourse-cdn.com/v4/letter/t/3bc359/32.png) [@Tarny\_GG\_Channie](https://discourse.julialang.org/u/Tarny_GG_Channie)\
**Post date:** [May 21, 2025, 3:20pm UTC](https://discourse.julialang.org/t/thought-move-gc-to-packages/129225/1 "2025-05-21T15:20:28Z")

</div>

Here’s some thought. Provide an abstract interface for writing a custom garbage collection. Objects created under garbage collector A gets managed by A (perhaps unless transfer ownership or something).

Now, things might get complicated. For example, imagine a type CustomGCRef{GC, eltype} or something…

This should provide a more fine-grained control over memory management. Still, lots of details are yet to be figured out.

---

<div class="post-metadata">

**Author:** ![Oscar\_Smith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oscar_smith/32/25343_2.png) [@Oscar\_Smith](https://discourse.julialang.org/u/Oscar_Smith)\
**Post date:** [May 21, 2025, 4:10pm UTC](https://discourse.julialang.org/t/thought-move-gc-to-packages/129225/2 "2025-05-21T16:10:43Z")

</div>

Have you been following the work to integrate MMTK?

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [May 21, 2025, 4:15pm UTC](https://discourse.julialang.org/t/thought-move-gc-to-packages/129225/3 "2025-05-21T16:15:31Z")

</div>

Read the paper: [https://www.steveblackburn.org/pubs/papers/julia-ismm-2025.pdf](https://www.steveblackburn.org/pubs/papers/julia-ismm-2025.pdf)

---

<div class="post-metadata">

**Author:** ![Tarny\_GG\_Channie](https://avatars.discourse-cdn.com/v4/letter/t/3bc359/32.png) [@Tarny\_GG\_Channie](https://discourse.julialang.org/u/Tarny_GG_Channie)\
**Post date:** [May 22, 2025, 12:43am UTC](https://discourse.julialang.org/t/thought-move-gc-to-packages/129225/4 "2025-05-22T00:43:25Z")

</div>

Oh, I see. It’s already… kind of being done?

But still, I want to be able to try my own silly GC idea if anything. I guess it’s being made more accessible over time? I don’t know.

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [May 22, 2025, 5:18am UTC](https://discourse.julialang.org/t/thought-move-gc-to-packages/129225/5 "2025-05-22T05:18:35Z")

</div>

This is the way to go for now: [GitHub - mmtk/mmtk-julia: Julia binding for MMTk](https://github.com/mmtk/mmtk-julia)

Not sure about plans to make it easier in the future. Conclusion:

- swapping the GC is already possible (on Linux, other OS will be supported in the future), but requires to build Julia from source
- swapping the GC by just loading a package looks difficult in my eyes, because the code that loads packages probably already needs a working GC and I don’t think that swapping a GC at runtime is possible. Perhaps a command line option would be possible.
- as far as I understand custom GCs using the MMTk interface need to be implemented in Rust and cannot be implemented in Julia
