Thought: Move GC to packages

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.

Have you been following the work to integrate MMTK?

1 Like

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

4 Likes

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.

This is the way to go for now: GitHub - mmtk/mmtk-julia: Julia binding for MMTk

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
4 Likes